All Projects → alexandrubagu → ecto_generator

alexandrubagu / ecto_generator

Licence: MIT License
Generate Ecto schemas from existing database in Phoenix - Elixir

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to ecto generator

contextual
🌈 Generate your Ecto contexts using this macro and eliminate boilerplate
Stars: ✭ 18 (-10%)
Mutual labels:  phoenix, generate, ecto
algoliax
Algolia integration to elixir application
Stars: ✭ 38 (+90%)
Mutual labels:  phoenix, ecto
query builder
Compose Ecto queries without effort
Stars: ✭ 56 (+180%)
Mutual labels:  phoenix, ecto
ecto profiler
Project for Ecto DB profiling
Stars: ✭ 16 (-20%)
Mutual labels:  phoenix, ecto
Phoenix Ecto Encryption Example
🔐 A detailed example for how to encrypt data in a Phoenix (Elixir) App before inserting into a database using Ecto Types
Stars: ✭ 166 (+730%)
Mutual labels:  phoenix, ecto
Formex
A better form library for Phoenix
Stars: ✭ 206 (+930%)
Mutual labels:  phoenix, ecto
querie
Compose Ecto query from the client side
Stars: ✭ 20 (+0%)
Mutual labels:  phoenix, ecto
Polymorphic embed
Polymorphic embeds in Ecto
Stars: ✭ 80 (+300%)
Mutual labels:  phoenix, ecto
ecto nested changeset
Helpers for manipulating nested Ecto changesets
Stars: ✭ 23 (+15%)
Mutual labels:  phoenix, ecto
guardian trackable
A Guardian hook to track user sign ins.
Stars: ✭ 25 (+25%)
Mutual labels:  phoenix, ecto
graphql-directive-sql
Unify your SQL schema and your GraphQL Schema. Use GraphQL SDL as the lingua franca to define your data requirements.
Stars: ✭ 28 (+40%)
Mutual labels:  schema, generate
Mipha
Proj Elixir Forum build with phoenix 1.5.
Stars: ✭ 153 (+665%)
Mutual labels:  phoenix, ecto
Phoenix live dashboard
Realtime dashboard with metrics, request logging, plus storage, OS and VM insights
Stars: ✭ 1,657 (+8185%)
Mutual labels:  phoenix, ecto
Params
Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters.
Stars: ✭ 239 (+1095%)
Mutual labels:  phoenix, ecto
Filterable
Filtering from incoming params in Elixir/Ecto/Phoenix with easy to use DSL.
Stars: ✭ 83 (+315%)
Mutual labels:  phoenix, ecto
phoenix pagination
Simple pagination for Ecto and Phoenix that uses plain EEx templates.
Stars: ✭ 20 (+0%)
Mutual labels:  phoenix, ecto
Wallaby
Concurrent browser tests with elixir
Stars: ✭ 1,143 (+5615%)
Mutual labels:  phoenix, ecto
Ecto morph
morph your Ecto capabilities into the s t r a t o s p h e r e !
Stars: ✭ 72 (+260%)
Mutual labels:  phoenix, ecto
txbox
Elixir Bitcoin transaction storage schema, built on Ecto.
Stars: ✭ 14 (-30%)
Mutual labels:  schema, ecto
ex sieve
Implement dynamic filtering and sorting API for Ecto queries
Stars: ✭ 37 (+85%)
Mutual labels:  phoenix, ecto

EctoGenerator

Generate Ecto schemas/models from existing database in Phoenix - Elixir

Installation

Generate new Phoenix application

[alexandrubagu@localhost devel]mix phoenix.new postgresapp

or

[alexandrubagu@localhost devel]mix phoenix.new mysqlapp --database mysql

Add ecto_generator to your list of dependencies in mix.exs:

def deps do
  [{:ecto_generator, "~> 9.0.0"}]
end

Install mix dependencies by running the following command in bash mix deps.get

Edit you configuration if is necessary:

# Configure your database
config :mysqlapp, Mysqlapp.Repo,
  adapter: Ecto.Adapters.MySQL,
  username: "root",
  password: "",
  database: "hello_phoenix_dev",
  hostname: "localhost",
  pool_size: 10

Now you will find ecto.dump.schema in mix tasks:

[alexandrubagu@localhost devel/phoenix/] mix ecto
Ecto v2.0.5
A database wrapper and language integrated query for Elixir.

Available tasks:

mix ecto.create        # Creates the repository storage
mix ecto.drop          # Drops the repository storage
mix ecto.dump          # Dumps the repository database structure
mix ecto.dump.schema   # Dump models/schemas from repos
mix ecto.gen.migration # Generates a new migration for the repo
mix ecto.gen.repo      # Generates a new repository
mix ecto.load          # Loads previously dumped database structure
mix ecto.migrate       # Runs the repository migrations
mix ecto.migrations    # Displays the repository migration status
mix ecto.rollback      # Rolls back the repository migrations

Output Sample

[alexandrubagu@localhost devel/mysqlapp ] mix ecto.dump.schema
13:15:04.270 [debug] QUERY OK db=0.8ms decode=0.1ms queue=15.2ms
SELECT table_name FROM information_schema.tables WHERE table_schema = 'sakila' []

13:15:04.272 [debug] QUERY OK db=0.9ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'actor' and table_schema='sakila' []
  web/models/actor.ex was generated

13:15:04.289 [debug] QUERY OK db=1.6ms decode=0.1ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'actor_info' and table_schema='sakila' []
  web/models/actor_info.ex was generated

13:15:04.293 [debug] QUERY OK db=1.2ms decode=0.1ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'address' and table_schema='sakila' []
  web/models/address.ex was generated

13:15:04.298 [debug] QUERY OK db=0.8ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'category' and table_schema='sakila' []
  web/models/category.ex was generated

13:15:04.302 [debug] QUERY OK db=0.8ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'city' and table_schema='sakila' []
  web/models/city.ex was generated

13:15:04.306 [debug] QUERY OK db=0.7ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'country' and table_schema='sakila' []
  web/models/country.ex was generated

13:15:04.310 [debug] QUERY OK db=1.0ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'customer' and table_schema='sakila' []
  web/models/customer.ex was generated
  enum is not supported ... Fallback to :string
  set is not supported ... Fallback to :string

13:15:04.314 [debug] QUERY OK db=0.9ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'film' and table_schema='sakila' []
  web/models/film.ex was generated

13:15:04.319 [debug] QUERY OK db=1.4ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'film_actor' and table_schema='sakila' []
  web/models/film_actor.ex was generated

13:15:04.323 [debug] QUERY OK db=0.9ms
SELECT COLUMN_NAME, DATA_TYPE, CASE WHEN `COLUMN_KEY` = 'PRI' THEN '1' ELSE NULL END AS primary_key FROM information_schema.columns WHERE table_name= 'film_category' and table_schema='sakila' []
  web/models/film_category.ex was generated
  enum is not supported ... Fallback to :string
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].