0

次のようなschema.sqlというファイルがあります。

drop table if exists codes;
create table paste_codes (
    id integer primary key autoincrement,
    codetitle string not null,
    codebody string not null,
    pub_date string not null
)

sqlite3 に電話してこのファイルから読み取り、データベースを作成する方法はありますか? cat schema.sql > sqlite3 /tmp/database.db のようなものですか?

ありがとう

4

1 に答える 1

0

これを修正しました。コードを次のように変更しました。

drop table if exists paste_code;
create table paste_code (
    id integer primary key autoincrement,
    codetitle string not null,
    codebody string not null,
    pub_date string not null
);

そして私は単に:

$ sqlite3 /tmp/database.db < schema.sql

そして、すべてが完璧に機能し始めました!

于 2012-06-09T19:36:41.180 に答える