[DATABASE] Introduce a bool type in schema
PostgreSQL has a clear distinction between integers and booleans, so it makes sense to draw a clear line.
This commit is contained in:
@@ -34,24 +34,24 @@ class User extends Managed_DataObject
|
||||
public $password; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $email; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $incomingemail; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $emailnotifysub; // tinyint(1) default_1
|
||||
public $emailnotifyfav; // tinyint(1) default_1
|
||||
public $emailnotifynudge; // tinyint(1) default_1
|
||||
public $emailnotifymsg; // tinyint(1) default_1
|
||||
public $emailnotifyattn; // tinyint(1) default_1
|
||||
public $emailnotifysub; // bool default_true
|
||||
public $emailnotifyfav; // tinyint(1) default_null
|
||||
public $emailnotifynudge; // bool default_true
|
||||
public $emailnotifymsg; // bool default_true
|
||||
public $emailnotifyattn; // bool default_true
|
||||
public $language; // varchar(50)
|
||||
public $timezone; // varchar(50)
|
||||
public $emailpost; // tinyint(1) default_1
|
||||
public $emailpost; // bool default_true
|
||||
public $sms; // varchar(64) unique_key
|
||||
public $carrier; // int(4)
|
||||
public $smsnotify; // tinyint(1)
|
||||
public $smsreplies; // tinyint(1)
|
||||
public $smsnotify; // bool default_false
|
||||
public $smsreplies; // bool default_false
|
||||
public $smsemail; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $autosubscribe; // tinyint(1)
|
||||
public $autosubscribe; // bool default_false
|
||||
public $subscribe_policy; // tinyint(1)
|
||||
public $urlshorteningservice; // varchar(50) default_ur1.ca
|
||||
public $private_stream; // tinyint(1) default_0
|
||||
public $private_stream; // bool default_false
|
||||
public $created; // datetime() not_null default_0000-00-00%2000%3A00%3A00
|
||||
public $modified; // datetime() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
@@ -68,24 +68,24 @@ class User extends Managed_DataObject
|
||||
'password' => array('type' => 'varchar', 'length' => 191, 'description' => 'salted password, can be null for OpenID users'),
|
||||
'email' => array('type' => 'varchar', 'length' => 191, 'description' => 'email address for password recovery etc.'),
|
||||
'incomingemail' => array('type' => 'varchar', 'length' => 191, 'description' => 'email address for post-by-email'),
|
||||
'emailnotifysub' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of subscriptions'),
|
||||
'emailnotifysub' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of subscriptions'),
|
||||
'emailnotifyfav' => array('type' => 'int', 'size' => 'tiny', 'default' => null, 'description' => 'Notify by email of favorites'),
|
||||
'emailnotifynudge' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of nudges'),
|
||||
'emailnotifymsg' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of direct messages'),
|
||||
'emailnotifyattn' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Notify by email of @-replies'),
|
||||
'emailnotifynudge' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of nudges'),
|
||||
'emailnotifymsg' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of direct messages'),
|
||||
'emailnotifyattn' => array('type' => 'bool', 'default' => true, 'description' => 'Notify by email of @-replies'),
|
||||
'language' => array('type' => 'varchar', 'length' => 50, 'description' => 'preferred language'),
|
||||
'timezone' => array('type' => 'varchar', 'length' => 50, 'description' => 'timezone'),
|
||||
'emailpost' => array('type' => 'int', 'size' => 'tiny', 'default' => 1, 'description' => 'Post by email'),
|
||||
'emailpost' => array('type' => 'bool', 'default' => true, 'description' => 'Post by email'),
|
||||
'sms' => array('type' => 'varchar', 'length' => 64, 'description' => 'sms phone number'),
|
||||
'carrier' => array('type' => 'int', 'description' => 'foreign key to sms_carrier'),
|
||||
'smsnotify' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to send notices to SMS'),
|
||||
'smsreplies' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to send notices to SMS on replies'),
|
||||
'smsnotify' => array('type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS'),
|
||||
'smsreplies' => array('type' => 'bool', 'default' => false, 'description' => 'whether to send notices to SMS on replies'),
|
||||
'smsemail' => array('type' => 'varchar', 'length' => 191, 'description' => 'built from sms and carrier'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier, usually a tag URI'),
|
||||
'autosubscribe' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'automatically subscribe to users who subscribe to us'),
|
||||
'autosubscribe' => array('type' => 'bool', 'default' => false, 'description' => 'automatically subscribe to users who subscribe to us'),
|
||||
'subscribe_policy' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => '0 = anybody can subscribe; 1 = require approval'),
|
||||
'urlshorteningservice' => array('type' => 'varchar', 'length' => 50, 'default' => 'internal', 'description' => 'service to use for auto-shortening URLs'),
|
||||
'private_stream' => array('type' => 'int', 'size' => 'tiny', 'default' => 0, 'description' => 'whether to limit all notices to followers only'),
|
||||
'private_stream' => array('type' => 'bool', 'default' => false, 'description' => 'whether to limit all notices to followers only'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'default' => '0000-00-00 00:00:00', 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'),
|
||||
),
|
||||
@@ -265,11 +265,11 @@ class User extends Managed_DataObject
|
||||
// Set default-on options here, otherwise they'll be disabled
|
||||
// initially for sites using caching, since the initial encache
|
||||
// doesn't know about the defaults in the database.
|
||||
$user->emailnotifysub = 1;
|
||||
$user->emailnotifynudge = 1;
|
||||
$user->emailnotifymsg = 1;
|
||||
$user->emailnotifyattn = 1;
|
||||
$user->emailpost = 1;
|
||||
$user->emailnotifysub = true;
|
||||
$user->emailnotifynudge = true;
|
||||
$user->emailnotifymsg = true;
|
||||
$user->emailnotifyattn = true;
|
||||
$user->emailpost = true;
|
||||
|
||||
$user->created = common_sql_now();
|
||||
|
||||
|
Reference in New Issue
Block a user