[Lift] Re: Extend the tables that like the migration in the Rails ?
Schemifier only adds, it does not remove. You have to do destructive operations manually. However, you can register for callbacks on column adds (e.g., MappedField.dbAddedColumn). You could use this function to look for an existing column that needs to be removed. On Mon, Oct 12, 2009 at 7:46 PM, Neil.Lv anim...@gmail.com wrote: Yeah, I see it now, and it works ! 1): ### I add a column in the User model, like this class User extends MegaProtoUser[User] { ... /* add column dos4 */ object dos4 extends MappedBoolean(this) ... } result: INFO - ALTER TABLE users ADD COLUMN do4 SMALLINT ### 2): ### I remove a column in the User model, like this class User extends MegaProtoUser[User] { ... /* remove column dos4 */ /* object dos4 extends MappedBoolean(this) */ ... } result: Don't remove the cloumn dos4. ### 3): How can i remove the column in the liftweb (change the structure of the table), just like the execute raw SQL statement. execute(SELECT * from users) # Rails code in Migration On Oct 13, 10:16 am, David Pollak feeder.of.the.be...@gmail.com wrote: Just add the column to the User model. Schemifier will add the column to the RDBMS. On Mon, Oct 12, 2009 at 6:20 PM, Neil.Lv anim...@gmail.com wrote: Yeah, I have add this code in the Boot.scala. ### Schemifier.schemify(true, Log.infoF _, User) ### But i want to add a column into the user table (extend the user table) now, and how can i achieve this purpose. Ex: ### Original user table like this idemail first_name last_name 1 a...@b.comhelloworld ### But the user table need to extend (add a column, like this) idemail first_name last_name sex 1 a...@b.comhelloworld 0 ### I add this code in the User model and restart the server, the table don't change anything ! ### Schemifier.schemify(true, Log.infoF _, User) # in the Boot.scala class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How the liftweb can do this ? Cheers, Neil On Oct 12, 6:10 pm, Peter Robinett pe...@bubblefoundry.com wrote: Is User added to Schemefier in Boot.scala? It should look something like: Schemifier.schemify(true, Log.infoF _, User) Peter Robinett On Oct 12, 11:22 am, Neil.Lv anim...@gmail.com wrote: Hi all, I don't know whether there is a mechanism that like the migration of the Rails in the Liftweb, and how can we extend the table, such as add a column desc into a table users (OR user ?). I add this code in the User model and restart the server, the table don't change anything ! ### class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How can i do if i want to achieve this purpose ? Thanks for any suggestion! Cheers, Neil -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Extend the tables that like the migration in the Rails ?
Is User added to Schemefier in Boot.scala? It should look something like: Schemifier.schemify(true, Log.infoF _, User) Peter Robinett On Oct 12, 11:22 am, Neil.Lv anim...@gmail.com wrote: Hi all, I don't know whether there is a mechanism that like the migration of the Rails in the Liftweb, and how can we extend the table, such as add a column desc into a table users (OR user ?). I add this code in the User model and restart the server, the table don't change anything ! ### class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How can i do if i want to achieve this purpose ? Thanks for any suggestion! Cheers, Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Extend the tables that like the migration in the Rails ?
Yeah, I have add this code in the Boot.scala. ### Schemifier.schemify(true, Log.infoF _, User) ### But i want to add a column into the user table (extend the user table) now, and how can i achieve this purpose. Ex: ### Original user table like this idemail first_name last_name 1 a...@b.comhelloworld ### But the user table need to extend (add a column, like this) idemail first_name last_name sex 1 a...@b.comhelloworld 0 ### I add this code in the User model and restart the server, the table don't change anything ! ### Schemifier.schemify(true, Log.infoF _, User) # in the Boot.scala class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How the liftweb can do this ? Cheers, Neil On Oct 12, 6:10 pm, Peter Robinett pe...@bubblefoundry.com wrote: Is User added to Schemefier in Boot.scala? It should look something like: Schemifier.schemify(true, Log.infoF _, User) Peter Robinett On Oct 12, 11:22 am, Neil.Lv anim...@gmail.com wrote: Hi all, I don't know whether there is a mechanism that like the migration of the Rails in the Liftweb, and how can we extend the table, such as add a column desc into a table users (OR user ?). I add this code in the User model and restart the server, the table don't change anything ! ### class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How can i do if i want to achieve this purpose ? Thanks for any suggestion! Cheers, Neil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Extend the tables that like the migration in the Rails ?
Just add the column to the User model. Schemifier will add the column to the RDBMS. On Mon, Oct 12, 2009 at 6:20 PM, Neil.Lv anim...@gmail.com wrote: Yeah, I have add this code in the Boot.scala. ### Schemifier.schemify(true, Log.infoF _, User) ### But i want to add a column into the user table (extend the user table) now, and how can i achieve this purpose. Ex: ### Original user table like this idemail first_name last_name 1 a...@b.comhelloworld ### But the user table need to extend (add a column, like this) idemail first_name last_name sex 1 a...@b.comhelloworld 0 ### I add this code in the User model and restart the server, the table don't change anything ! ### Schemifier.schemify(true, Log.infoF _, User) # in the Boot.scala class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How the liftweb can do this ? Cheers, Neil On Oct 12, 6:10 pm, Peter Robinett pe...@bubblefoundry.com wrote: Is User added to Schemefier in Boot.scala? It should look something like: Schemifier.schemify(true, Log.infoF _, User) Peter Robinett On Oct 12, 11:22 am, Neil.Lv anim...@gmail.com wrote: Hi all, I don't know whether there is a mechanism that like the migration of the Rails in the Liftweb, and how can we extend the table, such as add a column desc into a table users (OR user ?). I add this code in the User model and restart the server, the table don't change anything ! ### class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How can i do if i want to achieve this purpose ? Thanks for any suggestion! Cheers, Neil -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Extend the tables that like the migration in the Rails ?
Yeah, I see it now, and it works ! 1): ### I add a column in the User model, like this class User extends MegaProtoUser[User] { ... /* add column dos4 */ object dos4 extends MappedBoolean(this) ... } result: INFO - ALTER TABLE users ADD COLUMN do4 SMALLINT ### 2): ### I remove a column in the User model, like this class User extends MegaProtoUser[User] { ... /* remove column dos4 */ /* object dos4 extends MappedBoolean(this) */ ... } result: Don't remove the cloumn dos4. ### 3): How can i remove the column in the liftweb (change the structure of the table), just like the execute raw SQL statement. execute(SELECT * from users) # Rails code in Migration On Oct 13, 10:16 am, David Pollak feeder.of.the.be...@gmail.com wrote: Just add the column to the User model. Schemifier will add the column to the RDBMS. On Mon, Oct 12, 2009 at 6:20 PM, Neil.Lv anim...@gmail.com wrote: Yeah, I have add this code in the Boot.scala. ### Schemifier.schemify(true, Log.infoF _, User) ### But i want to add a column into the user table (extend the user table) now, and how can i achieve this purpose. Ex: ### Original user table like this idemail first_name last_name 1 a...@b.comhelloworld ### But the user table need to extend (add a column, like this) idemail first_name last_name sex 1 a...@b.comhelloworld 0 ### I add this code in the User model and restart the server, the table don't change anything ! ### Schemifier.schemify(true, Log.infoF _, User) # in the Boot.scala class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How the liftweb can do this ? Cheers, Neil On Oct 12, 6:10 pm, Peter Robinett pe...@bubblefoundry.com wrote: Is User added to Schemefier in Boot.scala? It should look something like: Schemifier.schemify(true, Log.infoF _, User) Peter Robinett On Oct 12, 11:22 am, Neil.Lv anim...@gmail.com wrote: Hi all, I don't know whether there is a mechanism that like the migration of the Rails in the Liftweb, and how can we extend the table, such as add a column desc into a table users (OR user ?). I add this code in the User model and restart the server, the table don't change anything ! ### class User extends MegaProtoUser[User] { ... object desc extends MappedPoliteString(this, 128) ... } ### How can i do if i want to achieve this purpose ? Thanks for any suggestion! Cheers, Neil -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---