Adding migrations for users and user groups. Also add authority permissions

This commit is contained in:
Paul Craciunoiu 2010-05-20 20:30:25 -07:00
Родитель 6b02b4f152
Коммит 462058a5ce
2 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,14 @@
-- Migrate the users first
INSERT IGNORE INTO auth_user (id, username, first_name, last_name,
email, password, is_staff, is_active,
is_superuser, last_login, date_joined)
SELECT users_users.userId, users_users.login, '', '',
users_users.email, '', 0, 1, 0,
FROM_UNIXTIME(users_users.registrationDate),
FROM_UNIXTIME(users_users.registrationDate)
FROM users_users;
INSERT INTO auth_group (id, name)
VALUES (1, 'Forum Moderators');
UPDATE auth_user SET password = '';

25
migrations/05-groups.sql Normal file
Просмотреть файл

@ -0,0 +1,25 @@
INSERT IGNORE INTO auth_user_groups (id, user_id, group_id)
SELECT NULL, users_users.userId, 1
FROM users_users, users_usergroups
WHERE users_users.userId = users_usergroups.userId
AND users_usergroups.groupName = 'Forum Moderators';
INSERT INTO authority_permission
VALUES
(NULL,'forums_forum.thread_edit_forum',14,1,NULL,1,47963,1,
'2010-05-20 10:37:22','2010-05-20 10:39:57'),
(NULL,'forums_forum.thread_delete_forum',14,1,NULL,1,47963,1,
'2010-05-20 10:37:22','2010-05-20 10:37:22'),
(NULL,'forums_forum.thread_sticky_forum',14,1,NULL,1,47963,1,
'2010-05-20 10:37:22','2010-05-20 10:37:22'),
(NULL,'forums_forum.post_edit_forum',14,1,NULL,1,47963,1,
'2010-05-20 10:37:22','2010-05-20 10:37:22'),
(NULL,'forums_forum.post_delete_forum',14,1,NULL,1,47963,1,
'2010-05-20 10:37:22','2010-05-20 10:37:22');
UPDATE auth_user
SET is_superuser = 1, is_staff = 1
WHERE id IN (SELECT users_users.userId
FROM users_users, users_usergroups
WHERE users_users.userId = users_usergroups.userId
AND users_usergroups.groupName = 'System Admins');