[ANN] Drift DB
Drift DB is a clojure database library focused on migration functions. With Drift DB you can create tables, drop tables, add columns to tables, remove columns from tables, query tables, and, though it is not the focus of Drift DB, you can insert, update, delete and select rows from tables. The only databases currently supported are H2 and Mysql. However, Drift DB uses a protocol to abstract out database specific code. All you would have to do to support other databases is implement the Drift DB protocol for it. Drift DB, like Drift, was originally a part of Conjure. However, I had several requests to separate out the function into their own library. Drift DB is not supposed to be a replacement for ClojureQL or Korma. Instead, Drift DB is focused on table altering and other tasks usually done in Drift migrations. Such tasks are currently not well supported in any other Clojure database library. All of the code for Drift DB can be found on github at: http://github.com/macourtney/drift-db Drift DB on Clojars: Drift DB Core: http://clojars.org/org.drift-db/drift-db Drift DB H2: http://clojars.org/org.drift-db/drift-db-h2 Drift DB Mysql: http://clojars.org/org.drift-db/drift-db-mysql -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Drift DB
That looks like a bug. I'll take a look at it, and get a fix in as soon as possible. -Matt On Nov 29, 12:03 am, Luc Prefontaine wrote: > Hi Matt, > > working with this stuff... pretty sure I can make rake obsolete pretty soon :) > > However I am struggling with the auto increment column attribute... > > (create-table > :meta-entities > (integer :id {:not-null true :auto-increment true :primary-key true}) > (string :name {:not-null true :unique true }) > (date-time :created_at) > (date-time :updated_at)) > > which looks to me compliant with what your code does in the mysql flavor lib. > > It yields in MySql: > > CREATE TABLE meta_entities ( > id int(11) NOT NULL, > name varchar(255) NOT NULL, > created_at datetime NULL, > updated_at datetime NULL, > PRIMARY KEY(id) > ) > ENGINE = InnoDB > AUTO_INCREMENT = 0 > > According to the AquaStudio tool I use to reverse engineer the DDL. > > The trace message: > > DEBUG Thread-51 2028 234732,063 drift-db-mysql.flavor ] > Create table: :meta-entities with specs: ({:not-null true, :primary-key true, > :spec-type :column, :type :integer, :name :id} {:not-null true, :spec-type > :column, :type :string, :name :name} {:spec-type :column, :type :date-time, > :name :created_at} {:spec-type :column, :type :date-time, :name :updated_at}) > > Looks like the :auto-increment is dropped. drift_db/core.clj at line 155 is > not selecting > it as a potential attribute of an integer field. > > I'll patch it locally so I can continue to play with it. > > Any reason why the id type does not accept optional attributes ? I use id > auto incremented keys > everywhere :) > > Thank you, > > Luc > > On Thu, 24 Nov 2011 14:58:43 -0800 (PST) > > > > > > > > > > Matt wrote: > > Drift DB is a clojure database library focused on migration functions. > > > With Drift DB you can create tables, drop tables, add columns to > > tables, remove columns from tables, query tables, and, though it is > > not the focus of Drift DB, you can insert, update, delete and select > > rows from tables. > > > The only databases currently supported are H2 and Mysql. However, > > Drift DB uses a protocol to abstract out database specific code. All > > you would have to do to support other databases is implement the Drift > > DB protocol for it. > > > Drift DB, like Drift, was originally a part of Conjure. However, I had > > several requests to separate out the function into their own library. > > > Drift DB is not supposed to be a replacement for ClojureQL or Korma. > > Instead, Drift DB is focused on table altering and other tasks usually > > done in Drift migrations. Such tasks are currently not well supported > > in any other Clojure database library. > > > All of the code for Drift DB can be found on github at: > >http://github.com/macourtney/drift-db > > > Drift DB on Clojars: > > > Drift DB Core:http://clojars.org/org.drift-db/drift-db > > Drift DB H2:http://clojars.org/org.drift-db/drift-db-h2 > > Drift DB Mysql:http://clojars.org/org.drift-db/drift-db-mysql > > -- > Luc P. > > > The rabid Muppet -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Drift DB
This should now be fixed in version 1.0.6. -Matt On Nov 29, 12:03 am, Luc Prefontaine wrote: > Hi Matt, > > working with this stuff... pretty sure I can make rake obsolete pretty soon :) > > However I am struggling with the auto increment column attribute... > > (create-table > :meta-entities > (integer :id {:not-null true :auto-increment true :primary-key true}) > (string :name {:not-null true :unique true }) > (date-time :created_at) > (date-time :updated_at)) > > which looks to me compliant with what your code does in the mysql flavor lib. > > It yields in MySql: > > CREATE TABLE meta_entities ( > id int(11) NOT NULL, > name varchar(255) NOT NULL, > created_at datetime NULL, > updated_at datetime NULL, > PRIMARY KEY(id) > ) > ENGINE = InnoDB > AUTO_INCREMENT = 0 > > According to the AquaStudio tool I use to reverse engineer the DDL. > > The trace message: > > DEBUG Thread-51 2028 234732,063 drift-db-mysql.flavor ] > Create table: :meta-entities with specs: ({:not-null true, :primary-key true, > :spec-type :column, :type :integer, :name :id} {:not-null true, :spec-type > :column, :type :string, :name :name} {:spec-type :column, :type :date-time, > :name :created_at} {:spec-type :column, :type :date-time, :name :updated_at}) > > Looks like the :auto-increment is dropped. drift_db/core.clj at line 155 is > not selecting > it as a potential attribute of an integer field. > > I'll patch it locally so I can continue to play with it. > > Any reason why the id type does not accept optional attributes ? I use id > auto incremented keys > everywhere :) > > Thank you, > > Luc > > On Thu, 24 Nov 2011 14:58:43 -0800 (PST) > > > > > > > > > > Matt wrote: > > Drift DB is a clojure database library focused on migration functions. > > > With Drift DB you can create tables, drop tables, add columns to > > tables, remove columns from tables, query tables, and, though it is > > not the focus of Drift DB, you can insert, update, delete and select > > rows from tables. > > > The only databases currently supported are H2 and Mysql. However, > > Drift DB uses a protocol to abstract out database specific code. All > > you would have to do to support other databases is implement the Drift > > DB protocol for it. > > > Drift DB, like Drift, was originally a part of Conjure. However, I had > > several requests to separate out the function into their own library. > > > Drift DB is not supposed to be a replacement for ClojureQL or Korma. > > Instead, Drift DB is focused on table altering and other tasks usually > > done in Drift migrations. Such tasks are currently not well supported > > in any other Clojure database library. > > > All of the code for Drift DB can be found on github at: > >http://github.com/macourtney/drift-db > > > Drift DB on Clojars: > > > Drift DB Core:http://clojars.org/org.drift-db/drift-db > > Drift DB H2:http://clojars.org/org.drift-db/drift-db-h2 > > Drift DB Mysql:http://clojars.org/org.drift-db/drift-db-mysql > > -- > Luc P. > > > The rabid Muppet -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Drift DB
Thank you, Luc On Wed, 30 Nov 2011 07:18:56 -0800 (PST) Matt wrote: > This should now be fixed in version 1.0.6. > > -Matt > > On Nov 29, 12:03 am, Luc Prefontaine > wrote: > > Hi Matt, > > > > working with this stuff... pretty sure I can make rake obsolete > > pretty soon :) > > > > However I am struggling with the auto increment column attribute... > > > > (create-table > > :meta-entities > > (integer :id {:not-null true :auto-increment true :primary-key > > true}) (string :name {:not-null true :unique true }) > > (date-time :created_at) > > (date-time :updated_at)) > > > > which looks to me compliant with what your code does in the mysql > > flavor lib. > > > > It yields in MySql: > > > > CREATE TABLE meta_entities ( > > id int(11) NOT NULL, > > name varchar(255) NOT NULL, > > created_at datetime NULL, > > updated_at datetime NULL, > > PRIMARY KEY(id) > > ) > > ENGINE = InnoDB > > AUTO_INCREMENT = 0 > > > > According to the AquaStudio tool I use to reverse engineer the DDL. > > > > The trace message: > > > > DEBUG Thread-51 2028 234732,063 > > drift-db-mysql.flavor ] Create table: :meta-entities with specs: > > ({:not-null true, :primary-key > > true, :spec-type :column, :type :integer, :name :id} {:not-null > > true, :spec-type :column, :type :string, :name :name} > > {:spec-type :column, :type :date-time, :name :created_at} > > {:spec-type :column, :type :date-time, :name :updated_at}) > > > > Looks like the :auto-increment is dropped. drift_db/core.clj at > > line 155 is not selecting it as a potential attribute of an integer > > field. > > > > I'll patch it locally so I can continue to play with it. > > > > Any reason why the id type does not accept optional attributes ? I > > use id auto incremented keys everywhere :) > > > > Thank you, > > > > Luc > > > > On Thu, 24 Nov 2011 14:58:43 -0800 (PST) > > > > > > > > > > > > > > > > > > > > Matt wrote: > > > Drift DB is a clojure database library focused on migration > > > functions. > > > > > With Drift DB you can create tables, drop tables, add columns to > > > tables, remove columns from tables, query tables, and, though it > > > is not the focus of Drift DB, you can insert, update, delete and > > > select rows from tables. > > > > > The only databases currently supported are H2 and Mysql. However, > > > Drift DB uses a protocol to abstract out database specific code. > > > All you would have to do to support other databases is implement > > > the Drift DB protocol for it. > > > > > Drift DB, like Drift, was originally a part of Conjure. However, > > > I had several requests to separate out the function into their > > > own library. > > > > > Drift DB is not supposed to be a replacement for ClojureQL or > > > Korma. Instead, Drift DB is focused on table altering and other > > > tasks usually done in Drift migrations. Such tasks are currently > > > not well supported in any other Clojure database library. > > > > > All of the code for Drift DB can be found on github at: > > >http://github.com/macourtney/drift-db > > > > > Drift DB on Clojars: > > > > > Drift DB Core:http://clojars.org/org.drift-db/drift-db > > > Drift DB H2:http://clojars.org/org.drift-db/drift-db-h2 > > > Drift DB Mysql:http://clojars.org/org.drift-db/drift-db-mysql > > > > -- > > Luc P. > > > > > > The rabid Muppet > -- Luc P. The rabid Muppet -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] Drift DB
Hi Matt, working with this stuff... pretty sure I can make rake obsolete pretty soon :) However I am struggling with the auto increment column attribute... (create-table :meta-entities (integer :id {:not-null true :auto-increment true :primary-key true}) (string :name {:not-null true :unique true }) (date-time :created_at) (date-time :updated_at)) which looks to me compliant with what your code does in the mysql flavor lib. It yields in MySql: CREATE TABLE meta_entities ( id int(11) NOT NULL, namevarchar(255) NOT NULL, created_at datetime NULL, updated_at datetime NULL, PRIMARY KEY(id) ) ENGINE = InnoDB AUTO_INCREMENT = 0 According to the AquaStudio tool I use to reverse engineer the DDL. The trace message: DEBUG Thread-51 2028 234732,063 drift-db-mysql.flavor ] Create table: :meta-entities with specs: ({:not-null true, :primary-key true, :spec-type :column, :type :integer, :name :id} {:not-null true, :spec-type :column, :type :string, :name :name} {:spec-type :column, :type :date-time, :name :created_at} {:spec-type :column, :type :date-time, :name :updated_at}) Looks like the :auto-increment is dropped. drift_db/core.clj at line 155 is not selecting it as a potential attribute of an integer field. I'll patch it locally so I can continue to play with it. Any reason why the id type does not accept optional attributes ? I use id auto incremented keys everywhere :) Thank you, Luc On Thu, 24 Nov 2011 14:58:43 -0800 (PST) Matt wrote: > Drift DB is a clojure database library focused on migration functions. > > With Drift DB you can create tables, drop tables, add columns to > tables, remove columns from tables, query tables, and, though it is > not the focus of Drift DB, you can insert, update, delete and select > rows from tables. > > The only databases currently supported are H2 and Mysql. However, > Drift DB uses a protocol to abstract out database specific code. All > you would have to do to support other databases is implement the Drift > DB protocol for it. > > Drift DB, like Drift, was originally a part of Conjure. However, I had > several requests to separate out the function into their own library. > > Drift DB is not supposed to be a replacement for ClojureQL or Korma. > Instead, Drift DB is focused on table altering and other tasks usually > done in Drift migrations. Such tasks are currently not well supported > in any other Clojure database library. > > All of the code for Drift DB can be found on github at: > http://github.com/macourtney/drift-db > > Drift DB on Clojars: > > Drift DB Core: http://clojars.org/org.drift-db/drift-db > Drift DB H2: http://clojars.org/org.drift-db/drift-db-h2 > Drift DB Mysql: http://clojars.org/org.drift-db/drift-db-mysql > -- Luc P. The rabid Muppet -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] Drift DB
Hi On 29 November 2011 07:03, Luc Prefontaine wrote: [...] > It yields in MySql: > > CREATE TABLE meta_entities ( > id int(11) NOT NULL, > name varchar(255) NOT NULL, > created_at datetime NULL, > updated_at datetime NULL, > PRIMARY KEY(id) > ) > ENGINE = InnoDB > AUTO_INCREMENT = 0 > > According to the AquaStudio tool I use to reverse engineer the DDL. Just by the way, MySQL supports this: SHOW CREATE TABLE meta_entities\G No need to reverse engineer the DDL for the tables :) -- Michael Wood -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] Drift DB
Ahem, considering that I regularly alternate between MySql, Postgres and Oracle databases, I like the idea of just calling a pop menu like "Create table (full)" and let Aqua spit out the DDL in an adjacent window while having a database explorer pane on the left :) Memory becomes a pricey real estate after a certain age :) I use Eclipse/CCW for the same reason, having to navigate in a multilingual code base, I cannot see myself learning different tools for editing purposes or having to remember a significant amount of Emacs key shortcuts. For those that are screaming at me (or laughing ironically), I started using Emacs in 1981 on a DEC-20. This version was written in Teco, extending Emacs was weirder than just dealing with a few parenthesis imbrications. I suspect that some of you were not born yet or were crawling around wearing a diaper :) You will all get there eventually (now I am laughing very loudly :) Luc On Wed, 30 Nov 2011 09:54:26 +0200 Michael Wood wrote: > Hi > > On 29 November 2011 07:03, Luc Prefontaine > wrote: [...] > > It yields in MySql: > > > > CREATE TABLE meta_entities ( > > id int(11) NOT NULL, > > name varchar(255) NOT NULL, > > created_at datetime NULL, > > updated_at datetime NULL, > > PRIMARY KEY(id) > > ) > > ENGINE = InnoDB > > AUTO_INCREMENT = 0 > > > > According to the AquaStudio tool I use to reverse engineer the DDL. > > Just by the way, MySQL supports this: > > SHOW CREATE TABLE meta_entities\G > > No need to reverse engineer the DDL for the tables :) > -- Luc P. The rabid Muppet -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
[ANN] Drift-db version 1.1.0 released
Drift-db version 1.1.0 released Drift-db is a library and companion project to Drift which gives you a standard interface for updating databases from migrations. In version 1.1.0: 1. Added support for Postgresql 2. Added offset and order-by as parameters to sql-find 3. Added an update-column function which allows you to alter a column already on a table with out having to remove and add it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: [ANN] Drift-db version 1.1.0 released
Forgot the link: https://github.com/macourtney/drift-db On Saturday, July 7, 2012 9:38:03 AM UTC-4, Matt wrote: > > Drift-db version 1.1.0 released > > Drift-db is a library and companion project to Drift which gives you a > standard interface for updating databases from migrations. > > In version 1.1.0: > > 1. Added support for Postgresql > 2. Added offset and order-by as parameters to sql-find > 3. Added an update-column function which allows you to alter a column > already on a table with out having to remove and add it. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en