On Monday, January 30, 2012 9:37:29 AM UTC-5, Massimo Di Pierro wrote:
>
> You can create schemas on the fly with web2py (web2py will do the
> alter table).
I think in RedBean you don't have to define the schema at all. With the
DAL, it would look something like:
db.define_table('person')
db.person.insert(name='John')
Notice that the 'name' field was never defined before the insert -- the
insert prompts the creation of the 'name' column in the 'person' table
(type is inferred based on the data, and altered if necessary based on
subsequent inserts). So, it enables use of a schema-based RDBMS more like a
schema-less NoSQL db. This "fluid" mode is recommended in development only,
after which, you are advised to "freeze" the
schema: http://redbeanphp.com/manual/freeze. So, it's taking automatic
migrations a step further and doing automatic (inferred) schema definitions
as well.
Anthony