{"repo":"cogini/ecto_extract_migrations","free":true,"listed":false,"github":"https://github.com/cogini/ecto_extract_migrations","clone":"git clone https://github.com/cogini/ecto_extract_migrations.git","description":"Elixir library to generate Ecto migrations from a PostgreSQL schema SQL file. Uses NimbleParsec and macro-style code generation.","language":"Elixir","stars":18,"topics":["elixir-library","ecto","postgresql","sql"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"ecto extract migrations Mix task to generate Ecto migrations from a Postgres schema SQL file. This lets you take an existing project and move it into Elixir with a proper development workflow. Usage 1. Generate a schema-only dump of the database to SQL: 2. Generate migrations from the SQL file: or, from outside the target project: 3. Create a test database, run migrations to create the schema, then export it and verify that it matches the original database: Details This was written to migrate a legacy database with hundreds of tables and objects. The parser uses NimbleParsec, and is based on the SQL grammar, so it is precise (unlike regex) and reasonably complete. It doesn't support every esoteric option, just what we needed, but that was quite a lot. Patches are welcome. Supports: ALTER SEQUENCE ALTER TABLE CREATE EXTENSION CREATE FUNCTION CREATE INDEX CREATE SCHEMA CREATE SEQUENCE CREATE TABLE CREATE TRIGGER CREATE TYPE CREATE VIEW Installation Add ecto extract migrations to your list of dependencies in mix.exs : Resources Here are some useful resources for NimbleParsec: https://stefan.lapers.be/posts/elixir-writing-an-expression-parser-with-nimble-parsec/ https://github.com/slapers/ex sel Alternatives ecto generator generates Ecto schemas by querying the database information schema ex abnf generates a parser based on an ABNF grammar.","default_branch":null,"files":null,"tree":[],"storefront":"/r/cogini","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cogini/ecto_extract_migrations/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}