Skip to content

edoceo/pg2sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Convert PostgreSQL to Sqlite

It converts a PostgreSQL database to Sqlite.

  • Tables: Works! and (mostly) maps data types
  • Foreign Keys: Sorta
  • Views: Not Yet, is it needed?
  • Materialized View: Not Likely
  • Functions: Nope
./pg2sqlite.php \
  --source=pgsql:DSN \
  --output=sqlite:DSN \
  --filter=/regular-expression/

The source parameter is required.

The output parameter is optional, the tool generates a unique-ish name.

The filter parameter is optional. If provided it becomes a pass-filter for the tables to export. The / delimiters are required.

Filter Examples

The filter can be any regular expression. Whatever parameter you provide is passed directly to preg_match.

# all tables with "contact" in the name
--filter=/contact/

# only the "contact" table
--filter=/^contact$/

# only "table_a" and "table_b"
--filter=/^(table_a|table_b)$/

# starts with "contact" or is "table_a" or "table_b"
--filter=/^(contact.*|(table_a|table_b))$/

See Also

About

Convert PostgreSQL Database into Sqlite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages