Log In
Log In
Places
All Projects
Status Monitor
Collapse sidebar
obs:server:fedora:2.6:testing
obs-server
obs-server-2.6.6-0013-api-fix-roles_users-via-p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File obs-server-2.6.6-0013-api-fix-roles_users-via-proper-id-column.patch of Package obs-server
From 05fb3ccd55dbf57d56241f594a768fe0b93f3552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= <adrian@suse.de> Date: Thu, 29 Jan 2015 09:21:10 +0100 Subject: [PATCH 13/14] [api] fix roles_users via proper id column We do not need it technically, but rails 4.2.0 wants to have it --- src/api/app/models/roles_user.rb | 2 -- src/api/db/migrate/20150129135426_add_roles_users_id.rb | 11 +++++++++++ src/api/db/structure.sql | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/api/db/migrate/20150129135426_add_roles_users_id.rb diff --git a/src/api/app/models/roles_user.rb b/src/api/app/models/roles_user.rb index 2bba27e..3918403 100644 --- a/src/api/app/models/roles_user.rb +++ b/src/api/app/models/roles_user.rb @@ -1,6 +1,4 @@ class RolesUser < ActiveRecord::Base belongs_to :user belongs_to :role - - self.primary_key = 'roles_users_all_index' end diff --git a/src/api/db/migrate/20150129135426_add_roles_users_id.rb b/src/api/db/migrate/20150129135426_add_roles_users_id.rb new file mode 100644 index 0000000..61b82b5 --- /dev/null +++ b/src/api/db/migrate/20150129135426_add_roles_users_id.rb @@ -0,0 +1,11 @@ + +class AddRolesUsersId < ActiveRecord::Migration + def self.up + sql = "alter table roles_users add id int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT" + ActiveRecord::Base.connection.execute(sql) + end + + def self.down + remove_column :roles_users, :id + end +end diff --git a/src/api/db/structure.sql b/src/api/db/structure.sql index f3076e3..ad987c4 100644 --- a/src/api/db/structure.sql +++ b/src/api/db/structure.sql @@ -946,6 +946,8 @@ CREATE TABLE `roles_users` ( `user_id` int(11) NOT NULL DEFAULT '0', `role_id` int(11) NOT NULL DEFAULT '0', `created_at` datetime DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), UNIQUE KEY `roles_users_all_index` (`user_id`,`role_id`), KEY `role_id` (`role_id`), CONSTRAINT `roles_users_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), @@ -1611,6 +1613,8 @@ INSERT INTO schema_migrations (version) VALUES ('20141022205426'); INSERT INTO schema_migrations (version) VALUES ('20141110105426'); +INSERT INTO schema_migrations (version) VALUES ('20150129135426'); + INSERT INTO schema_migrations (version) VALUES ('21'); INSERT INTO schema_migrations (version) VALUES ('22'); -- 2.1.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Log In
Places
Places
All Projects
Status Monitor