Commit here: http://github.com/jeremyevans/sequel/commit/fc8493c86fe3e02decfbc93d055d1065645c1596
Commit message: Refactor schema parsing, include primary key on PostgreSQL and MySQL This commit refactors the schema parsing. It eliminates the shared INFORMATION_SCHEMA based parsing that worked OK on PostgreSQL and very slowly on MySQL. The Database#schema public method has been kept, but the other shared private methods were removed, with the exception of schema_column_type for mapping database types to ruby types. MySQL, PostgreSQL, and SQLite schema parsing all include the :primary_key entry that shows whether the column is (part of) the primary key. PostgreSQL now uses the pg_* system catalogs directly, instead of the information_schema. MySQL uses the DESCRIBE syntax to get a table description. SQLite was cleaned up slightly, but still uses the table_info pragma. The shared Database#schema method now falls back to getting the schema separately for each table if it can't get the schema for all tables at once, assuming it knows how to get the schema for a single table and it knows how to get a list of tables. PostgreSQL now supports specifying a qualified table name (including schema) in the call to Database#schema. Before, the schema had to be specified explicity using the :schema option, which means it didn't work correctly with models. It still defaults to the public schema if no schema is specified (either explicitly or implicitly). This means that DB.schema(:s__t) now gives column information for table t in schema s. The :numeric_precision and :max_chars entries are no longer included in the hashes returned by schema. You should be able to get the same or similar information using the :db_type entry, which now includes specified lengths (e.g. varchar(255)). Since primary keys can now be parsed from the schema, use the schema information to set primary keys for schema models. In addition, this commit makes schema changing methods such as drop_table and alter_table remove the cached schema entry. It also has a small fix to drop_view to allow dropping multiple views at once, so it works just like drop_table. Additionally, it quotes the view names. The schema hash keys are now always supposed to be symbols. This commit also changes some specs to remove the use of set_schema, and it adds integration tests to test schema parsing of primary keys, NULL/NOT NULL, and defaults. This commit makes MySQL Database#tables work on JDBC as well as using the native adapter, by using the SHOW TABLES syntax. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
