Commit Graph

47 Commits

Author SHA1 Message Date
Brion Vibber
8454b1fbad Fix for schema upgrade issue when primary keys change; fixes upgrade direct from 0.8.x
Previously we were failing to update the primary key during ensureTable(), which could lead to failures when updating some tables (eg queue_item where we changed keys, and the addition of an autoincrement column failed because it conflicted with the old key).
Now if the key is different, we remove the old key at the start and add the new key at the end of the ALTER TABLE.

Not tested on PostgreSQL -- someone please check whether the alter table 'DROP CONSTRAINT PRIMARY KEY' bit works or if it needs to pull a special name for the key.
On MySQL, dropping uses alter table's 'DROP PRIMARY KEY' special case.
2011-09-08 13:03:22 -07:00
Brion Vibber
692ef9c330 Include fulltext indexes in MySQL table create 2010-11-01 13:27:44 -07:00
Brion Vibber
345b7d33b8 some sorta vaguely working bits 2010-10-29 15:28:48 -07:00
Brion Vibber
1daa1bfa39 fix notice 2010-10-29 14:49:05 -07:00
Brion Vibber
3b6f738ab7 Convert SamplePlugin to new-style table defs, tweak some stuff to test basic checkschema 2010-10-19 17:25:56 -07:00
Brion Vibber
8b0ba03a2e Starting to encapsulate some of the schema_version checksum / updater logic 2010-10-19 17:07:37 -07:00
Brion Vibber
7751d455de Initial foreign key setup support 2010-10-19 12:08:59 -07:00
Brion Vibber
d3f8a880a9 Fix misnamed unique constraint 2010-10-18 18:16:07 -07:00
Brion Vibber
ebe9972df6 tweak unique constraint setup 2010-10-18 18:07:25 -07:00
Brion Vibber
4aa6c4e49f MySQL schema: fix dropping unique indexes, add support for changing table properties back from old code. 2010-10-18 17:44:41 -07:00
Brion Vibber
a923ef9719 Drop reverseTypeMap from schemas; we're now doing the forward-mapping on the canonical def before comparing 2010-10-18 17:21:12 -07:00
Brion Vibber
eb93bdbb03 some more tweaking to do the mappings during filterDef; not totally sure I like it 2010-10-15 16:32:37 -07:00
Brion Vibber
90c35dc541 Cleanup on making the schema work for installer (not quite there yet) 2010-10-15 13:47:38 -07:00
Brion Vibber
77300f94a3 fix typo on params on Schema->createTable() 2010-10-15 13:34:54 -07:00
Brion Vibber
4f4b0a2612 logic fix in diffing :D 2010-10-13 16:56:49 -07:00
Brion Vibber
c0bb3062f6 suppress notices for non-present sections 2010-10-13 16:11:02 -07:00
Brion Vibber
229c772634 Filter table definitions to scrub out unsupported features before trying to alter a table. This lets us skip those where we end up trying to change unsupported features. 2010-10-13 16:04:28 -07:00
Brion Vibber
621233e1ad some of the ensureTable stuff partially working 2010-10-12 17:58:26 -07:00
Brion Vibber
72cba88650 fix for column prefixes in table/index building 2010-10-11 19:28:02 -07:00
Brion Vibber
2c9f877ab5 fix for index gen 2010-10-11 19:18:47 -07:00
Brion Vibber
9cb42c8e45 tweak for strings 2010-10-11 19:17:21 -07:00
Brion Vibber
9364e446b1 Start reworking things to build create table stuff (can view via dumpschema.php --build) 2010-10-11 19:10:51 -07:00
Brion Vibber
7f674cc957 Merge branch 'schema-x' of /Users/brion/pages/mublog into schema-x 2010-10-08 16:38:18 -07:00
Brion Vibber
2d0807bc1c Starting on adapting postgresql schema class to look stuff up in the new drupalish format...
Fetching basic column data and unique indexes. Still needs detail work, multi-value indexes, foreign keys, and distinguishing the primary key.
Since we don't get comments and such, for cleaner comparisons we should probably do a filtering on supported features.
2010-10-08 16:36:32 -07:00
Brion Vibber
2e475ceab0 Some more poking at schema stuff, on the road towards a more portable table-modification with the new schema bits 2010-10-07 18:33:02 -07:00
Brion Vibber
14e4f50f29 Some cleanup on detecting types 2010-10-07 16:49:49 -07:00
Brion Vibber
033a757013 More schema work in progress... removing duped code from schema child classes, rebuilding things a bit more (incomplete; non-working state) 2010-08-16 16:31:18 -07:00
Brion Vibber
eaa4ded053 first pass at columndef->drupal-style array converter (need to handle some more things probably; untested) 2010-08-16 15:14:16 -07:00
James Walker
47f19988d1 allow schema to work on more than one connection (namely, the Status_network DB) 2010-07-29 21:04:28 -04:00
Brion Vibber
9e9ab23e1f Fixes for updating indices, charset/collation and engine type on plugin-created tables.
Under MySQL, new tables will be created as InnoDB with UTF-8 (utf8/utf8_bin) same as core tables.
Existing plugin tables will have table engine and default charset/collation updated, and string columns will have charset updated, at checkschema time.

Switched from 'DESCRIBE' to INFORMATION_SCHEMA for pulling column information in order to get charset. A second hit to INFORMATION_SCHEMA is also needed to get table properties.

Indices were only being created at table creation time, which ain't so hot. Now also adding/dropping indices when they change.

Fixed up some schema defs in OStatus plugin that were a bit flaky, causing extra alter tables to be run.

TODO: Generalize this infrastructure a bit more up to base schema & pg schema classes.
2010-03-12 13:16:32 -08:00
Evan Prodromou
81087e45c5 move schema.type.php to typeschema.php like other files 2010-01-31 15:25:59 -05:00
Brenda Wallace
22a6e46b45 removed describeTable from base class, and fixed it up in pgsql 2010-01-30 21:22:30 +13:00
Brenda Wallace
870c83c17d getTableDef() mostly working in postgres 2010-01-30 21:12:06 +13:00
Brenda Wallace
e765a9657b move the schema DDL sql off into seperate files for each db we support 2010-01-30 18:45:10 +13:00
Zach Copley
9960ec2143 Support an 'extra' clause when definining a column (e.g.: 'on update
CURRENT_TIMESTAMP').
2010-01-05 23:19:13 -08:00
Brion Vibber
783a2e249b Fix for auto_increment parameter in auto-created tables via checkschema.
Update FeedSub plugin for non-Plugin_DataObject setup and working checkschema updates.
2010-01-04 10:30:58 -08:00
Brion Vibber
c89b10ffe4 Code style cleanup: dropped some unnecessary =& reference assignments where they're used only out of habit for PHP 4-style object semantics 2009-12-03 12:58:48 -08:00
Zach Copley
8acc1587b1 Revert "Allow plugin DB_DataObject classes to not have to use the .ini file by overriding keys(), table(), and sequenceKey() for them"
This reverts commit a373d07ae0.

Conflicts:

	classes/statusnet.ini
	lib/schema.php
	plugins/Authentication/AuthenticationPlugin.php
	plugins/OpenID/OpenIDPlugin.php
	plugins/UserFlag/UserFlagPlugin.php
2009-11-25 13:38:59 -08:00
Brion Vibber
2da531d7d6 Break TableDef, ColumnDef classes to separate files so autoloader can find them.
With $config['db']['schemacheck'] set to 'script' in live deployment, Schema class wasn't being preloaded for us; the uses of TableDef by plugins for DataObject configuration would then fail because the class wasn't loaded. Broken to separate files, the autoloader can find all classes in either case.

PHP Fatal error:  Class 'TableDef' not found in /var/www/statusnet/plugins/OpenID/User_openid.php on line 43, referer: http://identi.ca/brionv/all
2009-11-24 09:38:16 -08:00
Craig Andrews
a373d07ae0 Allow plugin DB_DataObject classes to not have to use the .ini file by overriding keys(), table(), and sequenceKey() for them 2009-11-16 15:24:25 -05:00
Evan Prodromou
87858a11f4 make lib/schema.php phpcs-clean 2009-10-02 15:02:33 -04:00
Evan Prodromou
544c58d263 Some bug fixes
The $tomod variable wasn't set, and the ColumnDef constructor
didn't work without any args. These are fixed.
2009-10-01 15:43:08 -04:00
Evan Prodromou
b980f5e45b add some more methods to Schema 2009-10-01 15:00:54 -04:00
Evan Prodromou
3449843f83 use schema tool to create a table 2009-09-23 22:24:35 -04:00
Evan Prodromou
e206324f24 statusize schema-related modules 2009-09-23 09:20:04 -04:00
Evan Prodromou
f31653ca5b make table def method of schema code work 2009-09-23 09:17:01 -04:00
Evan Prodromou
4f833531dd start a module for schema management 2009-09-23 09:17:01 -04:00