要生成sql脚本以创建给定数据库中的表,请执行以下操作:
pg_dump --schema-only --no-owner the_database > create_the_tables.sql
这将为您提供一系列create table语句.为了看看它的便携性,我try 了以下方法:
bvm$ pg_dump -s --no-owner devdb | sqlite3 so_ans.db
然后:
bvm$ sqlite3 so_ans.db .schema
CREATE TABLE courses (
id integer NOT NULL,
name text,
created_by integer,
jc text
);
有点酷.