SQL To D6 Schema Conversion Script?
Does anyone have a script that automates conversion of table creation SQL to a Drupal 6 schema definition? If not, maybe I'll see if I can cook something up as it seems like a lot of work otherwise. ;) Cheers, Mike
see schema.module in contrib. On Fri, Feb 15, 2008 at 2:54 PM, Mike Cantelon <m_cantelon@straight.com> wrote:
Does anyone have a script that automates conversion of table creation SQL to a Drupal 6 schema definition?
If not, maybe I'll see if I can cook something up as it seems like a lot of work otherwise. ;)
Cheers, Mike
see schema.module in contrib.
I installed that when working on the registry patch and was not really able to find where can I get the schema definiton of the not-yet-defined registry table. I might have missed something absolutely obvious. Please enlight the clueless.
Karoly Negyesi wrote:
see schema.module in contrib.
I installed that when working on the registry patch and was not really able to find where can I get the schema definiton of the not-yet-defined registry table. I might have missed something absolutely obvious.
There is an "Inspect" tab that will show you proposed schema for all unknown tables. I just copy and paste - with a bit of reformatting. Voila! Instant hook_schema. Nancy E. Wichmann, PMP
Nancy Wichmann wrote:
Karoly Negyesi wrote:
see schema.module in contrib.
I installed that when working on the registry patch and was not really able to find where can I get the schema definiton of the not-yet-defined registry table. I might have missed something absolutely obvious.
There is an "Inspect" tab that will show you proposed schema for all unknown tables. I just copy and paste - with a bit of reformatting. Voila! Instant hook_schema.
Can you confirm that this works? I tried with 6.x-1.2 with a new "foo" table I'd created by hand in PHPMyAdmin, and got a notice, a warning, and an empty schema array apart from the primary key. http://drupal.org/node/223952 I also noticed an inspectschema module in Frando's sandbox but that has fatal errors. Am I missing something obvious? -Angie
It works, but you have to delete the disp-width key from the field definition arrays it provides. On Wed, Apr 2, 2008 at 4:19 AM, Angela Byron <drupal-devel@webchick.net> wrote:
Nancy Wichmann wrote:
Karoly Negyesi wrote:
see schema.module in contrib.
I installed that when working on the registry patch and was not really able
to find where can I get the schema
definiton of the not-yet-defined registry table. I might have missed
something absolutely obvious.
There is an "Inspect" tab that will show you proposed schema for all unknown tables. I just copy and paste - with a bit of reformatting. Voila! Instant hook_schema.
Can you confirm that this works? I tried with 6.x-1.2 with a new "foo" table I'd created by hand in PHPMyAdmin, and got a notice, a warning, and an empty schema array apart from the primary key.
I also noticed an inspectschema module in Frando's sandbox but that has fatal errors.
Am I missing something obvious? -Angie
You need to first create a hook_schema() that defines the *tables*, and nothing else. At that point schema.module will go through and create proper definitions for all of the fields, indexes, etc in said tables. It appears that was done to avoid the module choking and dying on complex DB scenarios where Drupal was sharing its db with other systems, resulting in jillions of non-drupal tables to parse. --Jeff On Apr 2, 2008, at 3:19 AM, Angela Byron wrote:
Nancy Wichmann wrote:
Karoly Negyesi wrote:
see schema.module in contrib. I installed that when working on the registry patch and was not really able to find where can I get the schema definiton of the not-yet-defined registry table. I might have missed something absolutely obvious. There is an "Inspect" tab that will show you proposed schema for all unknown tables. I just copy and paste - with a bit of reformatting. Voila! Instant hook_schema.
Can you confirm that this works? I tried with 6.x-1.2 with a new "foo" table I'd created by hand in PHPMyAdmin, and got a notice, a warning, and an empty schema array apart from the primary key.
I also noticed an inspectschema module in Frando's sandbox but that has fatal errors.
Am I missing something obvious? -Angie
Angela Byron wrote:
Can you confirm that this works? I tried with 6.x-1.2 with a new "foo" table I'd created by hand in PHPMyAdmin, and got a notice, a warning, and an empty schema array apart from the primary key.
Angie, I too have had problems with Inspect in the 6.x version. When I wrote my original note, I did all those hook_schema creations using the 5.x version of the Schema module, which seems to work just fine. And, BTW, there is nor problem including a hook_schema in the 5.x versions of .install files - it just doesn't do anything except make the 5.x version of the Schema module happy. Nancy E. Wichmann, PMP
Yes, the inspectschema module in my sandbox has only been used during the process of getting the Schema API patch into core, and has not been updated anymore afterwards. In its more recent version it was also based on the schema extractor of schema.module. Any further work, if required, should of course go into schema.module. regards from peru -- frando Angela Byron-3 wrote:
Nancy Wichmann wrote:
Karoly Negyesi wrote:
see schema.module in contrib.
I installed that when working on the registry patch and was not really able to find where can I get the schema definiton of the not-yet-defined registry table. I might have missed something absolutely obvious.
There is an "Inspect" tab that will show you proposed schema for all unknown tables. I just copy and paste - with a bit of reformatting. Voila! Instant hook_schema.
Can you confirm that this works? I tried with 6.x-1.2 with a new "foo" table I'd created by hand in PHPMyAdmin, and got a notice, a warning, and an empty schema array apart from the primary key.
I also noticed an inspectschema module in Frando's sandbox but that has fatal errors.
Am I missing something obvious? -Angie
-- View this message in context: http://www.nabble.com/SQL-To-D6-Schema-Conversion-Script--tp15509961p1650734... Sent from the Drupal - Dev mailing list archive at Nabble.com.
participants (8)
-
Angela Byron -
Earl Dunovant -
Frando -
Jeff Eaton -
Karoly Negyesi -
Mike Cantelon -
Moshe Weitzman -
Nancy Wichmann