[Isocial-svn] SF.net SVN: isocial: [97] app
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <agu...@us...> - 2008-03-19 19:16:57
|
Revision: 97 http://isocial.svn.sourceforge.net/isocial/?rev=97&view=rev Author: aguidrevitch Date: 2008-03-19 12:17:02 -0700 (Wed, 19 Mar 2008) Log Message: ----------- cities list is going to be extensible / votable Modified Paths: -------------- app/installers/user_installer.php app/models/city.php Modified: app/installers/user_installer.php =================================================================== --- app/installers/user_installer.php 2008-03-18 19:21:16 UTC (rev 96) +++ app/installers/user_installer.php 2008-03-19 19:17:02 UTC (rev 97) @@ -57,27 +57,43 @@ $this->execute( "CREATE TABLE `countries` ( - `id` int(11) PRIMARY KEY, - `oid` int(11), - `name` char(255), - UNIQUE name_idx (name), - INDEX oid_idx (oid) + `id` int(11) PRIMARY KEY, + `name` char(50), + INDEX name_idx (name) ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `regions` ( + `id` int(11) PRIMARY KEY, + `country_id` int(11), + `parent_id` int(11), + `name` char(100), + FOREIGN KEY (country_id) REFERENCES countries(id), + FOREIGN KEY (parent_id) REFERENCES regions(id), + INDEX name_idx (name) + ) ENGINE=InnoDB"); $this->execute( "CREATE TABLE `cities` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `oid` int(11), `country_id` int(11), - `first_id` int(11), - `second_id` int(11), - `third_id` int(11), - `is_native` bool NOT NULL DEFAULT 0, + `region_id` int(11), `name` char(100) NOT NULL DEFAULT '', + `votes` int(11) NOT NULL DEFAULT 0, FOREIGN KEY (country_id) REFERENCES countries(id), - INDEX oid_idx (oid), - INDEX name_idx (name, first_id) + FOREIGN KEY (country_id) REFERENCES countries(id), + INDEX name_idx (name) ) ENGINE=InnoDB"); + + $this->execute( + "CREATE TABLE `city_votes` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `user_id` int(11), + `city_id` int(11), + FOREIGN KEY (user_id) REFERENCES users(id), + FOREIGN KEY (city_id) REFERENCES cities(id), + UNIQUE vote_idx (user_id, city_id) + ) ENGINE=InnoDB"); $this->execute( "CREATE TABLE `sexes` ( @@ -247,14 +263,15 @@ $this->dropTable('ims'); $this->dropTable('email_profiles'); $this->dropTable('basic_profiles'); - // triggers should be dropped automatically // http://dev.mysql.com/doc/refman/5.1/en/drop-trigger.html $this->dropTable('religious_view_votes'); $this->dropTable('religious_views'); $this->dropTable('political_views'); $this->dropTable('sexes'); + $this->dropTable('city_votes'); $this->dropTable('cities'); + $this->dropTable('regions'); $this->dropTable('countries'); $this->dropTable('messages'); $this->dropTable('friends'); Modified: app/models/city.php =================================================================== --- app/models/city.php 2008-03-18 19:21:16 UTC (rev 96) +++ app/models/city.php 2008-03-19 19:17:02 UTC (rev 97) @@ -1,8 +1,14 @@ <?php -class City extends ActiveRecord +class City extends VotableActiveRecord { var $belongs_to = array('Country'); + var $votes_model = 'ReligiousViewVote'; } +class CityVote extends ActiveRecord +{ + var $primary_key_name = 'city_id'; +} + ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |