houston-core 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aea60d0e5a29fcaf7c05ccc0978f6f2ec93c5fab
4
- data.tar.gz: 5e886c3a86565a55679dd3852c2f623b368faac9
3
+ metadata.gz: b40de6cc11ff71d0ad16e3711163e58834ae5abd
4
+ data.tar.gz: 5063b0c6c7f5b5d5acc6a2e55d4d64a4127c5f67
5
5
  SHA512:
6
- metadata.gz: 620021cdcfbb49903f623f64d73becdb0d65a16b5a9e140925b3492b7073c4cff8ee24c0baeb0073d21c632c7fcefa6dcdaf26c82c11e583b43f49bbfa67b938
7
- data.tar.gz: 76c018cf2d8a4eed980008319f3e91ac67c82fd95afe75a3e55daddb0b6d13a144860c71c993d9249c28563eb834ee43c2cd73393a6137ff5ff2c0a4746be90a
6
+ metadata.gz: 896255148b8824ed70c17dfd7fa9a43422667b53f8a909cc023f4afbca1f75c5871bc3e2494e0f32ee9078962719c73438f6839b209b077b86eefa65dbd23435
7
+ data.tar.gz: f618a5f488697b353a8c410079b4a6d974620b5d2da75d73d4f3d2f73a18320d75ec93161852186ed1c3a066aaaff87e7b516a2081dd3cc9c6b898736ed56c04
@@ -0,0 +1,63 @@
1
+ class ApiTokensController < ApplicationController
2
+ before_action :authenticate_user!
3
+ before_action :find_api_token, only: [:edit, :update, :destroy]
4
+
5
+ def index
6
+ @title = "API Tokens"
7
+ authorize! :read, :all_api_tokens
8
+ @api_tokens = ApiToken.all.preload(:user)
9
+ end
10
+
11
+ def mine
12
+ @title = "My API Tokens"
13
+ authorize! :create, ApiToken
14
+ @api_tokens = current_user.api_tokens
15
+ render action: :index
16
+ end
17
+
18
+ def new
19
+ @title = "New API Token"
20
+ authorize! :create, ApiToken
21
+ @api_token = ApiToken.new
22
+ end
23
+
24
+ def create
25
+ @api_token = current_user.api_tokens.build(params.require(:api_token).permit(:name))
26
+ authorize! :create, @api_token
27
+
28
+ if @api_token.save
29
+ redirect_to edit_api_token_path(@api_token)
30
+ else
31
+ render action: :new, error: @api_token.errors.full_messages.to_sentence
32
+ end
33
+ end
34
+
35
+ def edit
36
+ @title = "Edit API Token"
37
+ authorize! :update, @api_token
38
+ end
39
+
40
+ def update
41
+ authorize! :update, @api_token
42
+
43
+ if @api_token.update_attributes(params.require(:api_token).permit(:name))
44
+ redirect_to my_api_tokens_path
45
+ else
46
+ render action: :new
47
+ end
48
+ end
49
+
50
+ def destroy
51
+ authorize! :destroy, @api_token
52
+
53
+ @api_token.destroy
54
+ redirect_to my_api_tokens_path, notice: "Deleted API Token \"#{@api_token.name}\""
55
+ end
56
+
57
+ private
58
+
59
+ def find_api_token
60
+ @api_token = ApiToken.find(params[:id])
61
+ end
62
+
63
+ end
@@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
5
5
  # For APIs, you may want to use :null_session instead.
6
6
  protect_from_forgery with: :exception
7
7
 
8
+ before_action :token_authenticate!
8
9
  around_action :with_current_project
9
10
 
10
11
 
@@ -84,6 +85,23 @@ class ApplicationController < ActionController::Base
84
85
 
85
86
 
86
87
 
88
+ def token_authenticate!
89
+ return if current_user
90
+
91
+ token = request.authorization[/\ABearer (.*)\z/, 1] if request.authorization
92
+ user = User.joins(:api_tokens).find_by(api_tokens: { value: token }) if token
93
+ return unless user
94
+
95
+ @current_user = user
96
+ @authenticated_via_token = true
97
+ end
98
+
99
+ def authenticated_via_token?
100
+ @authenticated_via_token == true
101
+ end
102
+
103
+
104
+
87
105
  def api_authenticate!
88
106
  return if current_user
89
107
 
@@ -0,0 +1,18 @@
1
+ class ApiToken < ActiveRecord::Base
2
+ has_secure_token :value
3
+
4
+ belongs_to :user
5
+
6
+ validates :user_id, :name, :value, presence: true
7
+
8
+ before_validation :generate_value, on: :create
9
+
10
+ attr_readonly :user_id
11
+
12
+ private
13
+
14
+ def generate_value
15
+ self.value = ApiToken.generate_unique_secure_token
16
+ end
17
+
18
+ end
@@ -36,13 +36,13 @@ class PersistentTrigger < ActiveRecord::Base
36
36
 
37
37
 
38
38
  def register!
39
- trigger = Houston.config.triggers.build(type, value, action, params.merge(trigger: self), persistent_trigger_id: id)
40
- Houston.config.triggers.push(trigger) unless Houston.config.triggers.member?(trigger)
39
+ return if registered_trigger
40
+ @registered_trigger = Houston.config.triggers.create(type, value, action, params.merge(trigger: self), persistent_trigger_id: id)
41
41
  end
42
42
 
43
43
  def unregister!
44
- trigger = Houston.config.triggers.detect { |trigger| trigger.persistent_trigger_id == id }
45
- Houston.config.triggers.delete(trigger) if trigger
44
+ return unless registered_trigger
45
+ Houston.config.triggers.delete(registered_trigger)
46
46
  end
47
47
 
48
48
 
@@ -53,4 +53,8 @@ private
53
53
  errors.add :action, "#{action.inspect} is not defined"
54
54
  end
55
55
 
56
+ def registered_trigger
57
+ @registered_trigger ||= Houston.config.triggers.detect { |trigger| trigger.persistent_trigger_id == id }
58
+ end
59
+
56
60
  end
@@ -6,6 +6,7 @@ class User < ActiveRecord::Base
6
6
 
7
7
  has_many :roles, class_name: "TeamUser", dependent: :destroy
8
8
  has_and_belongs_to_many :teams
9
+ has_many :api_tokens, dependent: :destroy
9
10
  has_many :authorizations, dependent: :destroy
10
11
  has_many :triggers, class_name: "PersistentTrigger", dependent: :destroy
11
12
  has_and_belongs_to_many :followed_projects, -> { unretired }, join_table: "follows", class_name: "Project"
@@ -17,7 +17,9 @@
17
17
  <%= action.error.message %>
18
18
  <% end %>
19
19
  </td>
20
+ <% if can?(:run, Action) %>
20
21
  <td class="action-retry"><%= button_to "Retry", retry_action_path(action), class: "btn-retry btn btn-mini btn-default" %></td>
22
+ <% end %>
21
23
  <td class="table-margin"></td>
22
24
  </tr>
23
25
  <% end %>
@@ -48,7 +48,7 @@
48
48
  <td class="action-duration" data-position="0">&mdash;</td>
49
49
  <% end %>
50
50
  <td class="action-run-now">
51
- <% if action[:required_params].empty? %>
51
+ <% if action[:required_params].empty? && can?(:run, Action) %>
52
52
  <%= button_to "Run now", run_action_path(slug: action[:name]), :class => "btn btn-default" %>
53
53
  <% end %>
54
54
  </td>
@@ -19,7 +19,9 @@
19
19
  <th class="action-params">Params</th>
20
20
  <th class="action-succeeded">Succeeded</th>
21
21
  <th class="action-exception">Exception</th>
22
+ <% if can?(:run, Action) %>
22
23
  <th class="action-retry">Retry</th>
24
+ <% end %>
23
25
  <td class="table-margin"></td>
24
26
  </tr>
25
27
  </thead>
@@ -0,0 +1,51 @@
1
+ <%= form_for @api_token, html: {class: "form-horizontal"} do |f| %>
2
+ <fieldset>
3
+ <div class="control-group">
4
+ <%= f.label :name, class: "control-label" %>
5
+ <div class="controls">
6
+ <%= f.text_field :name, class: "text_field" %>
7
+ </div>
8
+ </div>
9
+
10
+ <% if @api_token.persisted? %>
11
+ <div class="control-group">
12
+ <%= f.label :value, class: "control-label" %>
13
+ <div class="controls">
14
+ <%= f.text_field :value, class: "text_field", readonly: true %>
15
+ </div>
16
+ </div>
17
+ <% end %>
18
+ </fieldset>
19
+
20
+ <div class="form-actions">
21
+ <%= f.submit nil, class: "btn btn-primary" %>
22
+ <%= link_to "Cancel", my_api_tokens_path, class: "btn" %>
23
+
24
+ <% if @api_token.persisted? && can?(:destroy, @api_token) %>
25
+ <button class="btn btn-delete btn-danger" id="delete_api_token_button">Delete</button>
26
+ <% end %>
27
+ </div>
28
+ <% end %>
29
+
30
+ <% content_for :javascripts do %>
31
+ <script type="text/javascript">
32
+ $(function() {
33
+ <% if @api_token.persisted? && can?(:destroy, @api_token) %>
34
+ $('#delete_api_token_button').click(function(e) {
35
+ e.preventDefault();
36
+ App.confirmDelete({
37
+ resource: 'API Token',
38
+ message: 'This will delete the API Token "<%= @api_token.name %>".',
39
+ url: <%=raw api_token_path(@api_token).to_json %>
40
+ });
41
+ });
42
+ <% end %>
43
+
44
+ <% if @api_token.persisted? %>
45
+ $('#api_token_value').select();
46
+ <% else %>
47
+ $('#api_token_name').select();
48
+ <% end %>
49
+ });
50
+ </script>
51
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% content_for :title do %>
2
+ <h1 class="project-banner space-below">
3
+ Edit API Token
4
+ </h1>
5
+ <% end %>
6
+
7
+ <%= render "form" %>
@@ -0,0 +1,44 @@
1
+ <% content_for :title do %>
2
+ <h1 class="project-banner space-below">
3
+ <%= @title %>
4
+
5
+ <%= link_to "New API Token", new_api_token_path, class: "btn btn-primary" if can?(:create, ApiToken) %>
6
+ </h1>
7
+ <% end %>
8
+
9
+ <div class="nomargin">
10
+ <table id="api_tokens" class="table table-sortable table-striped">
11
+ <thead>
12
+ <tr>
13
+ <td class="table-margin"></td>
14
+ <td class="user-avatar"></td>
15
+ <th class="user-name sort-desc">User</th>
16
+ <th class="api-token-name">Name</th>
17
+ <td class="table-margin"></td>
18
+ </tr>
19
+ </thead>
20
+ <tbody>
21
+ <% @api_tokens.each do |api_token| %>
22
+ <tr class="api_token">
23
+ <td class="table-margin"></td>
24
+ <td class="user-avatar"><%= avatar_for(api_token.user, size: 32) %></td>
25
+ <td class="user-name">
26
+ <span class="first-name"><%= api_token.user.first_name %></span>
27
+ <span class="last-name"><%= api_token.user.last_name %></span>
28
+ </td>
29
+ <td class="api-token-name"><%= link_to api_token.name, edit_api_token_path(api_token) %></td>
30
+ <td class="table-margin"></td>
31
+ </tr>
32
+ <% end %>
33
+ </tbody>
34
+ </table>
35
+ </div>
36
+
37
+
38
+ <% content_for :javascripts do %>
39
+ <script type="text/javascript">
40
+ $(function() {
41
+ $('#api_tokens').tablesorter();
42
+ });
43
+ </script>
44
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% content_for :title do %>
2
+ <h1 class="project-banner space-below">
3
+ New API Token
4
+ </h1>
5
+ <% end %>
6
+
7
+ <%= render "form" %>
@@ -18,7 +18,9 @@
18
18
  <th class="action-params">Params</th>
19
19
  <td class="action-succeeded"></td>
20
20
  <th class="action-exception">Exception</th>
21
+ <% if can?(:run, Action) %>
21
22
  <th class="action-retry">Retry</th>
23
+ <% end %>
22
24
  <td class="table-margin"></td>
23
25
  </tr>
24
26
  </thead>
@@ -29,6 +29,7 @@
29
29
  <% if can?(:read, :all_authorizations) %>
30
30
  <li class="divider"></li>
31
31
  <li><%= link_to "Authorizations", main_app.authorizations_path %></li>
32
+ <li><%= link_to "API Tokens", main_app.api_tokens_path %></li>
32
33
  <% end %>
33
34
  <% end %>
34
35
  </ul>
@@ -43,6 +44,7 @@
43
44
  <% if can?(:create, Authorization) %>
44
45
  <li class="divider"></li>
45
46
  <li><%= link_to "My Authorizations", main_app.my_authorizations_path %></li>
47
+ <li><%= link_to "My API Tokens", main_app.my_api_tokens_path %></li>
46
48
  <% end %>
47
49
  <li class="divider"></li>
48
50
  <li><%= link_to "Sign out", main_app.destroy_user_session_path %></li>
@@ -76,6 +76,18 @@ Rails.application.routes.draw do
76
76
 
77
77
 
78
78
 
79
+ # API Tokens
80
+
81
+ get "api_tokens" => "api_tokens#index", as: :api_tokens
82
+ get "my/api_tokens" => "api_tokens#mine", as: :my_api_tokens
83
+ get "api_tokens/new" => "api_tokens#new", as: :new_api_token
84
+ post "api_tokens" => "api_tokens#create"
85
+ get "api_tokens/:id/edit" => "api_tokens#edit", as: :edit_api_token
86
+ patch "api_tokens/:id" => "api_tokens#update", as: :api_token
87
+ delete "api_tokens/:id" => "api_tokens#destroy"
88
+
89
+
90
+
79
91
  # Actions
80
92
 
81
93
  get "actions", to: "actions#index", as: :actions
@@ -0,0 +1,11 @@
1
+ class CreateApiTokens < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :api_tokens do |t|
4
+ t.string :name, null: false
5
+ t.references :user, null: false, foreign_key: true
6
+ t.string :value, null: false
7
+
8
+ t.index :value
9
+ end
10
+ end
11
+ end
@@ -2,14 +2,15 @@
2
2
  -- PostgreSQL database dump
3
3
  --
4
4
 
5
- -- Dumped from database version 9.6.2
6
- -- Dumped by pg_dump version 9.6.2
5
+ -- Dumped from database version 10.5
6
+ -- Dumped by pg_dump version 10.5
7
7
 
8
8
  SET statement_timeout = 0;
9
9
  SET lock_timeout = 0;
10
10
  SET idle_in_transaction_session_timeout = 0;
11
11
  SET client_encoding = 'UTF8';
12
12
  SET standard_conforming_strings = on;
13
+ SELECT pg_catalog.set_config('search_path', '', false);
13
14
  SET check_function_bodies = false;
14
15
  SET client_min_messages = warning;
15
16
  SET row_security = off;
@@ -28,8 +29,6 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
28
29
  COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
29
30
 
30
31
 
31
- SET search_path = public, pg_catalog;
32
-
33
32
  SET default_tablespace = '';
34
33
 
35
34
  SET default_with_oids = false;
@@ -38,7 +37,7 @@ SET default_with_oids = false;
38
37
  -- Name: actions; Type: TABLE; Schema: public; Owner: -
39
38
  --
40
39
 
41
- CREATE TABLE actions (
40
+ CREATE TABLE public.actions (
42
41
  id integer NOT NULL,
43
42
  name character varying NOT NULL,
44
43
  started_at timestamp without time zone,
@@ -55,7 +54,7 @@ CREATE TABLE actions (
55
54
  -- Name: actions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
56
55
  --
57
56
 
58
- CREATE SEQUENCE actions_id_seq
57
+ CREATE SEQUENCE public.actions_id_seq
59
58
  START WITH 1
60
59
  INCREMENT BY 1
61
60
  NO MINVALUE
@@ -67,14 +66,46 @@ CREATE SEQUENCE actions_id_seq
67
66
  -- Name: actions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
68
67
  --
69
68
 
70
- ALTER SEQUENCE actions_id_seq OWNED BY actions.id;
69
+ ALTER SEQUENCE public.actions_id_seq OWNED BY public.actions.id;
70
+
71
+
72
+ --
73
+ -- Name: api_tokens; Type: TABLE; Schema: public; Owner: -
74
+ --
75
+
76
+ CREATE TABLE public.api_tokens (
77
+ id integer NOT NULL,
78
+ name character varying NOT NULL,
79
+ user_id integer NOT NULL,
80
+ value character varying NOT NULL
81
+ );
82
+
83
+
84
+ --
85
+ -- Name: api_tokens_id_seq; Type: SEQUENCE; Schema: public; Owner: -
86
+ --
87
+
88
+ CREATE SEQUENCE public.api_tokens_id_seq
89
+ AS integer
90
+ START WITH 1
91
+ INCREMENT BY 1
92
+ NO MINVALUE
93
+ NO MAXVALUE
94
+ CACHE 1;
95
+
96
+
97
+ --
98
+ -- Name: api_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
99
+ --
100
+
101
+ ALTER SEQUENCE public.api_tokens_id_seq OWNED BY public.api_tokens.id;
71
102
 
72
103
 
73
104
  --
74
105
  -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
75
106
  --
76
107
 
77
- CREATE TABLE ar_internal_metadata (
108
+ CREATE TABLE public.ar_internal_metadata (
78
109
  key character varying NOT NULL,
79
110
  value character varying,
80
111
  created_at timestamp without time zone NOT NULL,
@@ -86,7 +117,7 @@ CREATE TABLE ar_internal_metadata (
86
117
  -- Name: authorizations; Type: TABLE; Schema: public; Owner: -
87
118
  --
88
119
 
89
- CREATE TABLE authorizations (
120
+ CREATE TABLE public.authorizations (
90
121
  id integer NOT NULL,
91
122
  scope character varying,
92
123
  access_token character varying,
@@ -106,7 +137,7 @@ CREATE TABLE authorizations (
106
137
  -- Name: authorizations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
107
138
  --
108
139
 
109
- CREATE SEQUENCE authorizations_id_seq
140
+ CREATE SEQUENCE public.authorizations_id_seq
110
141
  START WITH 1
111
142
  INCREMENT BY 1
112
143
  NO MINVALUE
@@ -118,14 +149,14 @@ CREATE SEQUENCE authorizations_id_seq
118
149
  -- Name: authorizations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
119
150
  --
120
151
 
121
- ALTER SEQUENCE authorizations_id_seq OWNED BY authorizations.id;
152
+ ALTER SEQUENCE public.authorizations_id_seq OWNED BY public.authorizations.id;
122
153
 
123
154
 
124
155
  --
125
156
  -- Name: errors; Type: TABLE; Schema: public; Owner: -
126
157
  --
127
158
 
128
- CREATE TABLE errors (
159
+ CREATE TABLE public.errors (
129
160
  id integer NOT NULL,
130
161
  sha character varying NOT NULL,
131
162
  message text NOT NULL,
@@ -140,7 +171,7 @@ CREATE TABLE errors (
140
171
  -- Name: errors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
141
172
  --
142
173
 
143
- CREATE SEQUENCE errors_id_seq
174
+ CREATE SEQUENCE public.errors_id_seq
144
175
  START WITH 1
145
176
  INCREMENT BY 1
146
177
  NO MINVALUE
@@ -152,14 +183,14 @@ CREATE SEQUENCE errors_id_seq
152
183
  -- Name: errors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
153
184
  --
154
185
 
155
- ALTER SEQUENCE errors_id_seq OWNED BY errors.id;
186
+ ALTER SEQUENCE public.errors_id_seq OWNED BY public.errors.id;
156
187
 
157
188
 
158
189
  --
159
190
  -- Name: follows; Type: TABLE; Schema: public; Owner: -
160
191
  --
161
192
 
162
- CREATE TABLE follows (
193
+ CREATE TABLE public.follows (
163
194
  id integer NOT NULL,
164
195
  user_id integer,
165
196
  project_id integer
@@ -170,7 +201,7 @@ CREATE TABLE follows (
170
201
  -- Name: follows_id_seq; Type: SEQUENCE; Schema: public; Owner: -
171
202
  --
172
203
 
173
- CREATE SEQUENCE follows_id_seq
204
+ CREATE SEQUENCE public.follows_id_seq
174
205
  START WITH 1
175
206
  INCREMENT BY 1
176
207
  NO MINVALUE
@@ -182,14 +213,14 @@ CREATE SEQUENCE follows_id_seq
182
213
  -- Name: follows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
183
214
  --
184
215
 
185
- ALTER SEQUENCE follows_id_seq OWNED BY follows.id;
216
+ ALTER SEQUENCE public.follows_id_seq OWNED BY public.follows.id;
186
217
 
187
218
 
188
219
  --
189
220
  -- Name: measurements; Type: TABLE; Schema: public; Owner: -
190
221
  --
191
222
 
192
- CREATE TABLE measurements (
223
+ CREATE TABLE public.measurements (
193
224
  id integer NOT NULL,
194
225
  subject_type character varying,
195
226
  subject_id integer,
@@ -206,7 +237,7 @@ CREATE TABLE measurements (
206
237
  -- Name: measurements_id_seq; Type: SEQUENCE; Schema: public; Owner: -
207
238
  --
208
239
 
209
- CREATE SEQUENCE measurements_id_seq
240
+ CREATE SEQUENCE public.measurements_id_seq
210
241
  START WITH 1
211
242
  INCREMENT BY 1
212
243
  NO MINVALUE
@@ -218,14 +249,14 @@ CREATE SEQUENCE measurements_id_seq
218
249
  -- Name: measurements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
219
250
  --
220
251
 
221
- ALTER SEQUENCE measurements_id_seq OWNED BY measurements.id;
252
+ ALTER SEQUENCE public.measurements_id_seq OWNED BY public.measurements.id;
222
253
 
223
254
 
224
255
  --
225
256
  -- Name: persistent_triggers; Type: TABLE; Schema: public; Owner: -
226
257
  --
227
258
 
228
- CREATE TABLE persistent_triggers (
259
+ CREATE TABLE public.persistent_triggers (
229
260
  id integer NOT NULL,
230
261
  type character varying NOT NULL,
231
262
  value text NOT NULL,
@@ -239,7 +270,7 @@ CREATE TABLE persistent_triggers (
239
270
  -- Name: persistent_triggers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
240
271
  --
241
272
 
242
- CREATE SEQUENCE persistent_triggers_id_seq
273
+ CREATE SEQUENCE public.persistent_triggers_id_seq
243
274
  START WITH 1
244
275
  INCREMENT BY 1
245
276
  NO MINVALUE
@@ -251,14 +282,14 @@ CREATE SEQUENCE persistent_triggers_id_seq
251
282
  -- Name: persistent_triggers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
252
283
  --
253
284
 
254
- ALTER SEQUENCE persistent_triggers_id_seq OWNED BY persistent_triggers.id;
285
+ ALTER SEQUENCE public.persistent_triggers_id_seq OWNED BY public.persistent_triggers.id;
255
286
 
256
287
 
257
288
  --
258
289
  -- Name: projects; Type: TABLE; Schema: public; Owner: -
259
290
  --
260
291
 
261
- CREATE TABLE projects (
292
+ CREATE TABLE public.projects (
262
293
  id integer NOT NULL,
263
294
  name character varying NOT NULL,
264
295
  slug character varying NOT NULL,
@@ -284,7 +315,7 @@ CREATE TABLE projects (
284
315
  -- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
285
316
  --
286
317
 
287
- CREATE SEQUENCE projects_id_seq
318
+ CREATE SEQUENCE public.projects_id_seq
288
319
  START WITH 1
289
320
  INCREMENT BY 1
290
321
  NO MINVALUE
@@ -296,14 +327,14 @@ CREATE SEQUENCE projects_id_seq
296
327
  -- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
297
328
  --
298
329
 
299
- ALTER SEQUENCE projects_id_seq OWNED BY projects.id;
330
+ ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id;
300
331
 
301
332
 
302
333
  --
303
334
  -- Name: roles; Type: TABLE; Schema: public; Owner: -
304
335
  --
305
336
 
306
- CREATE TABLE roles (
337
+ CREATE TABLE public.roles (
307
338
  id integer NOT NULL,
308
339
  user_id integer,
309
340
  project_id integer,
@@ -317,7 +348,7 @@ CREATE TABLE roles (
317
348
  -- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
318
349
  --
319
350
 
320
- CREATE SEQUENCE roles_id_seq
351
+ CREATE SEQUENCE public.roles_id_seq
321
352
  START WITH 1
322
353
  INCREMENT BY 1
323
354
  NO MINVALUE
@@ -329,14 +360,14 @@ CREATE SEQUENCE roles_id_seq
329
360
  -- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
330
361
  --
331
362
 
332
- ALTER SEQUENCE roles_id_seq OWNED BY roles.id;
363
+ ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id;
333
364
 
334
365
 
335
366
  --
336
367
  -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
337
368
  --
338
369
 
339
- CREATE TABLE schema_migrations (
370
+ CREATE TABLE public.schema_migrations (
340
371
  version character varying NOT NULL
341
372
  );
342
373
 
@@ -345,7 +376,7 @@ CREATE TABLE schema_migrations (
345
376
  -- Name: teams; Type: TABLE; Schema: public; Owner: -
346
377
  --
347
378
 
348
- CREATE TABLE teams (
379
+ CREATE TABLE public.teams (
349
380
  id integer NOT NULL,
350
381
  name character varying,
351
382
  props jsonb DEFAULT '{}'::jsonb
@@ -356,7 +387,7 @@ CREATE TABLE teams (
356
387
  -- Name: teams_id_seq; Type: SEQUENCE; Schema: public; Owner: -
357
388
  --
358
389
 
359
- CREATE SEQUENCE teams_id_seq
390
+ CREATE SEQUENCE public.teams_id_seq
360
391
  START WITH 1
361
392
  INCREMENT BY 1
362
393
  NO MINVALUE
@@ -368,14 +399,14 @@ CREATE SEQUENCE teams_id_seq
368
399
  -- Name: teams_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
369
400
  --
370
401
 
371
- ALTER SEQUENCE teams_id_seq OWNED BY teams.id;
402
+ ALTER SEQUENCE public.teams_id_seq OWNED BY public.teams.id;
372
403
 
373
404
 
374
405
  --
375
406
  -- Name: teams_users; Type: TABLE; Schema: public; Owner: -
376
407
  --
377
408
 
378
- CREATE TABLE teams_users (
409
+ CREATE TABLE public.teams_users (
379
410
  id integer NOT NULL,
380
411
  team_id integer,
381
412
  user_id integer,
@@ -389,7 +420,7 @@ CREATE TABLE teams_users (
389
420
  -- Name: teams_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
390
421
  --
391
422
 
392
- CREATE SEQUENCE teams_users_id_seq
423
+ CREATE SEQUENCE public.teams_users_id_seq
393
424
  START WITH 1
394
425
  INCREMENT BY 1
395
426
  NO MINVALUE
@@ -401,14 +432,14 @@ CREATE SEQUENCE teams_users_id_seq
401
432
  -- Name: teams_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
402
433
  --
403
434
 
404
- ALTER SEQUENCE teams_users_id_seq OWNED BY teams_users.id;
435
+ ALTER SEQUENCE public.teams_users_id_seq OWNED BY public.teams_users.id;
405
436
 
406
437
 
407
438
  --
408
439
  -- Name: users; Type: TABLE; Schema: public; Owner: -
409
440
  --
410
441
 
411
- CREATE TABLE users (
442
+ CREATE TABLE public.users (
412
443
  id integer NOT NULL,
413
444
  email character varying DEFAULT ''::character varying NOT NULL,
414
445
  encrypted_password character varying DEFAULT ''::character varying,
@@ -446,7 +477,7 @@ CREATE TABLE users (
446
477
  -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
447
478
  --
448
479
 
449
- CREATE SEQUENCE users_id_seq
480
+ CREATE SEQUENCE public.users_id_seq
450
481
  START WITH 1
451
482
  INCREMENT BY 1
452
483
  NO MINVALUE
@@ -458,14 +489,14 @@ CREATE SEQUENCE users_id_seq
458
489
  -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
459
490
  --
460
491
 
461
- ALTER SEQUENCE users_id_seq OWNED BY users.id;
492
+ ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
462
493
 
463
494
 
464
495
  --
465
496
  -- Name: versions; Type: TABLE; Schema: public; Owner: -
466
497
  --
467
498
 
468
- CREATE TABLE versions (
499
+ CREATE TABLE public.versions (
469
500
  id integer NOT NULL,
470
501
  versioned_type character varying,
471
502
  versioned_id integer,
@@ -485,7 +516,7 @@ CREATE TABLE versions (
485
516
  -- Name: versions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
486
517
  --
487
518
 
488
- CREATE SEQUENCE versions_id_seq
519
+ CREATE SEQUENCE public.versions_id_seq
489
520
  START WITH 1
490
521
  INCREMENT BY 1
491
522
  NO MINVALUE
@@ -497,106 +528,121 @@ CREATE SEQUENCE versions_id_seq
497
528
  -- Name: versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
498
529
  --
499
530
 
500
- ALTER SEQUENCE versions_id_seq OWNED BY versions.id;
531
+ ALTER SEQUENCE public.versions_id_seq OWNED BY public.versions.id;
501
532
 
502
533
 
503
534
  --
504
535
  -- Name: actions id; Type: DEFAULT; Schema: public; Owner: -
505
536
  --
506
537
 
507
- ALTER TABLE ONLY actions ALTER COLUMN id SET DEFAULT nextval('actions_id_seq'::regclass);
538
+ ALTER TABLE ONLY public.actions ALTER COLUMN id SET DEFAULT nextval('public.actions_id_seq'::regclass);
539
+
540
+
541
+ --
542
+ -- Name: api_tokens id; Type: DEFAULT; Schema: public; Owner: -
543
+ --
544
+
545
+ ALTER TABLE ONLY public.api_tokens ALTER COLUMN id SET DEFAULT nextval('public.api_tokens_id_seq'::regclass);
508
546
 
509
547
 
510
548
  --
511
549
  -- Name: authorizations id; Type: DEFAULT; Schema: public; Owner: -
512
550
  --
513
551
 
514
- ALTER TABLE ONLY authorizations ALTER COLUMN id SET DEFAULT nextval('authorizations_id_seq'::regclass);
552
+ ALTER TABLE ONLY public.authorizations ALTER COLUMN id SET DEFAULT nextval('public.authorizations_id_seq'::regclass);
515
553
 
516
554
 
517
555
  --
518
556
  -- Name: errors id; Type: DEFAULT; Schema: public; Owner: -
519
557
  --
520
558
 
521
- ALTER TABLE ONLY errors ALTER COLUMN id SET DEFAULT nextval('errors_id_seq'::regclass);
559
+ ALTER TABLE ONLY public.errors ALTER COLUMN id SET DEFAULT nextval('public.errors_id_seq'::regclass);
522
560
 
523
561
 
524
562
  --
525
563
  -- Name: follows id; Type: DEFAULT; Schema: public; Owner: -
526
564
  --
527
565
 
528
- ALTER TABLE ONLY follows ALTER COLUMN id SET DEFAULT nextval('follows_id_seq'::regclass);
566
+ ALTER TABLE ONLY public.follows ALTER COLUMN id SET DEFAULT nextval('public.follows_id_seq'::regclass);
529
567
 
530
568
 
531
569
  --
532
570
  -- Name: measurements id; Type: DEFAULT; Schema: public; Owner: -
533
571
  --
534
572
 
535
- ALTER TABLE ONLY measurements ALTER COLUMN id SET DEFAULT nextval('measurements_id_seq'::regclass);
573
+ ALTER TABLE ONLY public.measurements ALTER COLUMN id SET DEFAULT nextval('public.measurements_id_seq'::regclass);
536
574
 
537
575
 
538
576
  --
539
577
  -- Name: persistent_triggers id; Type: DEFAULT; Schema: public; Owner: -
540
578
  --
541
579
 
542
- ALTER TABLE ONLY persistent_triggers ALTER COLUMN id SET DEFAULT nextval('persistent_triggers_id_seq'::regclass);
580
+ ALTER TABLE ONLY public.persistent_triggers ALTER COLUMN id SET DEFAULT nextval('public.persistent_triggers_id_seq'::regclass);
543
581
 
544
582
 
545
583
  --
546
584
  -- Name: projects id; Type: DEFAULT; Schema: public; Owner: -
547
585
  --
548
586
 
549
- ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);
587
+ ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass);
550
588
 
551
589
 
552
590
  --
553
591
  -- Name: roles id; Type: DEFAULT; Schema: public; Owner: -
554
592
  --
555
593
 
556
- ALTER TABLE ONLY roles ALTER COLUMN id SET DEFAULT nextval('roles_id_seq'::regclass);
594
+ ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass);
557
595
 
558
596
 
559
597
  --
560
598
  -- Name: teams id; Type: DEFAULT; Schema: public; Owner: -
561
599
  --
562
600
 
563
- ALTER TABLE ONLY teams ALTER COLUMN id SET DEFAULT nextval('teams_id_seq'::regclass);
601
+ ALTER TABLE ONLY public.teams ALTER COLUMN id SET DEFAULT nextval('public.teams_id_seq'::regclass);
564
602
 
565
603
 
566
604
  --
567
605
  -- Name: teams_users id; Type: DEFAULT; Schema: public; Owner: -
568
606
  --
569
607
 
570
- ALTER TABLE ONLY teams_users ALTER COLUMN id SET DEFAULT nextval('teams_users_id_seq'::regclass);
608
+ ALTER TABLE ONLY public.teams_users ALTER COLUMN id SET DEFAULT nextval('public.teams_users_id_seq'::regclass);
571
609
 
572
610
 
573
611
  --
574
612
  -- Name: users id; Type: DEFAULT; Schema: public; Owner: -
575
613
  --
576
614
 
577
- ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
615
+ ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
578
616
 
579
617
 
580
618
  --
581
619
  -- Name: versions id; Type: DEFAULT; Schema: public; Owner: -
582
620
  --
583
621
 
584
- ALTER TABLE ONLY versions ALTER COLUMN id SET DEFAULT nextval('versions_id_seq'::regclass);
622
+ ALTER TABLE ONLY public.versions ALTER COLUMN id SET DEFAULT nextval('public.versions_id_seq'::regclass);
585
623
 
586
624
 
587
625
  --
588
626
  -- Name: actions actions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
589
627
  --
590
628
 
591
- ALTER TABLE ONLY actions
629
+ ALTER TABLE ONLY public.actions
592
630
  ADD CONSTRAINT actions_pkey PRIMARY KEY (id);
593
631
 
594
632
 
633
+ --
634
+ -- Name: api_tokens api_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
635
+ --
636
+
637
+ ALTER TABLE ONLY public.api_tokens
638
+ ADD CONSTRAINT api_tokens_pkey PRIMARY KEY (id);
639
+
640
+
595
641
  --
596
642
  -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
597
643
  --
598
644
 
599
- ALTER TABLE ONLY ar_internal_metadata
645
+ ALTER TABLE ONLY public.ar_internal_metadata
600
646
  ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
601
647
 
602
648
 
@@ -604,7 +650,7 @@ ALTER TABLE ONLY ar_internal_metadata
604
650
  -- Name: authorizations authorizations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
605
651
  --
606
652
 
607
- ALTER TABLE ONLY authorizations
653
+ ALTER TABLE ONLY public.authorizations
608
654
  ADD CONSTRAINT authorizations_pkey PRIMARY KEY (id);
609
655
 
610
656
 
@@ -612,7 +658,7 @@ ALTER TABLE ONLY authorizations
612
658
  -- Name: errors errors_pkey; Type: CONSTRAINT; Schema: public; Owner: -
613
659
  --
614
660
 
615
- ALTER TABLE ONLY errors
661
+ ALTER TABLE ONLY public.errors
616
662
  ADD CONSTRAINT errors_pkey PRIMARY KEY (id);
617
663
 
618
664
 
@@ -620,7 +666,7 @@ ALTER TABLE ONLY errors
620
666
  -- Name: follows follows_pkey; Type: CONSTRAINT; Schema: public; Owner: -
621
667
  --
622
668
 
623
- ALTER TABLE ONLY follows
669
+ ALTER TABLE ONLY public.follows
624
670
  ADD CONSTRAINT follows_pkey PRIMARY KEY (id);
625
671
 
626
672
 
@@ -628,7 +674,7 @@ ALTER TABLE ONLY follows
628
674
  -- Name: measurements measurements_pkey; Type: CONSTRAINT; Schema: public; Owner: -
629
675
  --
630
676
 
631
- ALTER TABLE ONLY measurements
677
+ ALTER TABLE ONLY public.measurements
632
678
  ADD CONSTRAINT measurements_pkey PRIMARY KEY (id);
633
679
 
634
680
 
@@ -636,7 +682,7 @@ ALTER TABLE ONLY measurements
636
682
  -- Name: persistent_triggers persistent_triggers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
637
683
  --
638
684
 
639
- ALTER TABLE ONLY persistent_triggers
685
+ ALTER TABLE ONLY public.persistent_triggers
640
686
  ADD CONSTRAINT persistent_triggers_pkey PRIMARY KEY (id);
641
687
 
642
688
 
@@ -644,7 +690,7 @@ ALTER TABLE ONLY persistent_triggers
644
690
  -- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
645
691
  --
646
692
 
647
- ALTER TABLE ONLY projects
693
+ ALTER TABLE ONLY public.projects
648
694
  ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
649
695
 
650
696
 
@@ -652,7 +698,7 @@ ALTER TABLE ONLY projects
652
698
  -- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
653
699
  --
654
700
 
655
- ALTER TABLE ONLY roles
701
+ ALTER TABLE ONLY public.roles
656
702
  ADD CONSTRAINT roles_pkey PRIMARY KEY (id);
657
703
 
658
704
 
@@ -660,7 +706,7 @@ ALTER TABLE ONLY roles
660
706
  -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
661
707
  --
662
708
 
663
- ALTER TABLE ONLY schema_migrations
709
+ ALTER TABLE ONLY public.schema_migrations
664
710
  ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
665
711
 
666
712
 
@@ -668,7 +714,7 @@ ALTER TABLE ONLY schema_migrations
668
714
  -- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: -
669
715
  --
670
716
 
671
- ALTER TABLE ONLY teams
717
+ ALTER TABLE ONLY public.teams
672
718
  ADD CONSTRAINT teams_pkey PRIMARY KEY (id);
673
719
 
674
720
 
@@ -676,7 +722,7 @@ ALTER TABLE ONLY teams
676
722
  -- Name: teams_users teams_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
677
723
  --
678
724
 
679
- ALTER TABLE ONLY teams_users
725
+ ALTER TABLE ONLY public.teams_users
680
726
  ADD CONSTRAINT teams_users_pkey PRIMARY KEY (id);
681
727
 
682
728
 
@@ -684,7 +730,7 @@ ALTER TABLE ONLY teams_users
684
730
  -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
685
731
  --
686
732
 
687
- ALTER TABLE ONLY users
733
+ ALTER TABLE ONLY public.users
688
734
  ADD CONSTRAINT users_pkey PRIMARY KEY (id);
689
735
 
690
736
 
@@ -692,7 +738,7 @@ ALTER TABLE ONLY users
692
738
  -- Name: versions versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
693
739
  --
694
740
 
695
- ALTER TABLE ONLY versions
741
+ ALTER TABLE ONLY public.versions
696
742
  ADD CONSTRAINT versions_pkey PRIMARY KEY (id);
697
743
 
698
744
 
@@ -700,199 +746,221 @@ ALTER TABLE ONLY versions
700
746
  -- Name: index_actions_on_name; Type: INDEX; Schema: public; Owner: -
701
747
  --
702
748
 
703
- CREATE INDEX index_actions_on_name ON actions USING btree (name);
749
+ CREATE INDEX index_actions_on_name ON public.actions USING btree (name);
750
+
751
+
752
+ --
753
+ -- Name: index_api_tokens_on_user_id; Type: INDEX; Schema: public; Owner: -
754
+ --
755
+
756
+ CREATE INDEX index_api_tokens_on_user_id ON public.api_tokens USING btree (user_id);
757
+
758
+
759
+ --
760
+ -- Name: index_api_tokens_on_value; Type: INDEX; Schema: public; Owner: -
761
+ --
762
+
763
+ CREATE INDEX index_api_tokens_on_value ON public.api_tokens USING btree (value);
704
764
 
705
765
 
706
766
  --
707
767
  -- Name: index_authorizations_on_user_id; Type: INDEX; Schema: public; Owner: -
708
768
  --
709
769
 
710
- CREATE INDEX index_authorizations_on_user_id ON authorizations USING btree (user_id);
770
+ CREATE INDEX index_authorizations_on_user_id ON public.authorizations USING btree (user_id);
711
771
 
712
772
 
713
773
  --
714
774
  -- Name: index_errors_on_sha; Type: INDEX; Schema: public; Owner: -
715
775
  --
716
776
 
717
- CREATE UNIQUE INDEX index_errors_on_sha ON errors USING btree (sha);
777
+ CREATE UNIQUE INDEX index_errors_on_sha ON public.errors USING btree (sha);
718
778
 
719
779
 
720
780
  --
721
781
  -- Name: index_follows_on_project_id; Type: INDEX; Schema: public; Owner: -
722
782
  --
723
783
 
724
- CREATE INDEX index_follows_on_project_id ON follows USING btree (project_id);
784
+ CREATE INDEX index_follows_on_project_id ON public.follows USING btree (project_id);
725
785
 
726
786
 
727
787
  --
728
788
  -- Name: index_follows_on_user_id; Type: INDEX; Schema: public; Owner: -
729
789
  --
730
790
 
731
- CREATE INDEX index_follows_on_user_id ON follows USING btree (user_id);
791
+ CREATE INDEX index_follows_on_user_id ON public.follows USING btree (user_id);
732
792
 
733
793
 
734
794
  --
735
795
  -- Name: index_measurements_on_name; Type: INDEX; Schema: public; Owner: -
736
796
  --
737
797
 
738
- CREATE INDEX index_measurements_on_name ON measurements USING btree (name);
798
+ CREATE INDEX index_measurements_on_name ON public.measurements USING btree (name);
739
799
 
740
800
 
741
801
  --
742
802
  -- Name: index_measurements_on_subject_type_and_subject_id; Type: INDEX; Schema: public; Owner: -
743
803
  --
744
804
 
745
- CREATE INDEX index_measurements_on_subject_type_and_subject_id ON measurements USING btree (subject_type, subject_id);
805
+ CREATE INDEX index_measurements_on_subject_type_and_subject_id ON public.measurements USING btree (subject_type, subject_id);
746
806
 
747
807
 
748
808
  --
749
809
  -- Name: index_measurements_on_taken_at; Type: INDEX; Schema: public; Owner: -
750
810
  --
751
811
 
752
- CREATE INDEX index_measurements_on_taken_at ON measurements USING btree (taken_at);
812
+ CREATE INDEX index_measurements_on_taken_at ON public.measurements USING btree (taken_at);
753
813
 
754
814
 
755
815
  --
756
816
  -- Name: index_measurements_on_taken_on; Type: INDEX; Schema: public; Owner: -
757
817
  --
758
818
 
759
- CREATE INDEX index_measurements_on_taken_on ON measurements USING btree (taken_on);
819
+ CREATE INDEX index_measurements_on_taken_on ON public.measurements USING btree (taken_on);
760
820
 
761
821
 
762
822
  --
763
823
  -- Name: index_projects_on_slug; Type: INDEX; Schema: public; Owner: -
764
824
  --
765
825
 
766
- CREATE UNIQUE INDEX index_projects_on_slug ON projects USING btree (slug);
826
+ CREATE UNIQUE INDEX index_projects_on_slug ON public.projects USING btree (slug);
767
827
 
768
828
 
769
829
  --
770
830
  -- Name: index_roles_on_user_id_and_project_id; Type: INDEX; Schema: public; Owner: -
771
831
  --
772
832
 
773
- CREATE INDEX index_roles_on_user_id_and_project_id ON roles USING btree (user_id, project_id);
833
+ CREATE INDEX index_roles_on_user_id_and_project_id ON public.roles USING btree (user_id, project_id);
774
834
 
775
835
 
776
836
  --
777
837
  -- Name: index_roles_on_user_id_and_project_id_and_name; Type: INDEX; Schema: public; Owner: -
778
838
  --
779
839
 
780
- CREATE INDEX index_roles_on_user_id_and_project_id_and_name ON roles USING btree (user_id, project_id, name);
840
+ CREATE INDEX index_roles_on_user_id_and_project_id_and_name ON public.roles USING btree (user_id, project_id, name);
781
841
 
782
842
 
783
843
  --
784
844
  -- Name: index_teams_users_on_team_id_and_user_id; Type: INDEX; Schema: public; Owner: -
785
845
  --
786
846
 
787
- CREATE UNIQUE INDEX index_teams_users_on_team_id_and_user_id ON teams_users USING btree (team_id, user_id);
847
+ CREATE UNIQUE INDEX index_teams_users_on_team_id_and_user_id ON public.teams_users USING btree (team_id, user_id);
788
848
 
789
849
 
790
850
  --
791
851
  -- Name: index_users_on_authentication_token; Type: INDEX; Schema: public; Owner: -
792
852
  --
793
853
 
794
- CREATE INDEX index_users_on_authentication_token ON users USING btree (authentication_token);
854
+ CREATE INDEX index_users_on_authentication_token ON public.users USING btree (authentication_token);
795
855
 
796
856
 
797
857
  --
798
858
  -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -
799
859
  --
800
860
 
801
- CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email);
861
+ CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email);
802
862
 
803
863
 
804
864
  --
805
865
  -- Name: index_users_on_email_addresses; Type: INDEX; Schema: public; Owner: -
806
866
  --
807
867
 
808
- CREATE INDEX index_users_on_email_addresses ON users USING btree (email_addresses);
868
+ CREATE INDEX index_users_on_email_addresses ON public.users USING btree (email_addresses);
809
869
 
810
870
 
811
871
  --
812
872
  -- Name: index_users_on_invitation_token; Type: INDEX; Schema: public; Owner: -
813
873
  --
814
874
 
815
- CREATE INDEX index_users_on_invitation_token ON users USING btree (invitation_token);
875
+ CREATE INDEX index_users_on_invitation_token ON public.users USING btree (invitation_token);
816
876
 
817
877
 
818
878
  --
819
879
  -- Name: index_users_on_invited_by_id; Type: INDEX; Schema: public; Owner: -
820
880
  --
821
881
 
822
- CREATE INDEX index_users_on_invited_by_id ON users USING btree (invited_by_id);
882
+ CREATE INDEX index_users_on_invited_by_id ON public.users USING btree (invited_by_id);
823
883
 
824
884
 
825
885
  --
826
886
  -- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -
827
887
  --
828
888
 
829
- CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);
889
+ CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING btree (reset_password_token);
830
890
 
831
891
 
832
892
  --
833
893
  -- Name: index_versions_on_created_at; Type: INDEX; Schema: public; Owner: -
834
894
  --
835
895
 
836
- CREATE INDEX index_versions_on_created_at ON versions USING btree (created_at);
896
+ CREATE INDEX index_versions_on_created_at ON public.versions USING btree (created_at);
837
897
 
838
898
 
839
899
  --
840
900
  -- Name: index_versions_on_number; Type: INDEX; Schema: public; Owner: -
841
901
  --
842
902
 
843
- CREATE INDEX index_versions_on_number ON versions USING btree (number);
903
+ CREATE INDEX index_versions_on_number ON public.versions USING btree (number);
844
904
 
845
905
 
846
906
  --
847
907
  -- Name: index_versions_on_tag; Type: INDEX; Schema: public; Owner: -
848
908
  --
849
909
 
850
- CREATE INDEX index_versions_on_tag ON versions USING btree (tag);
910
+ CREATE INDEX index_versions_on_tag ON public.versions USING btree (tag);
851
911
 
852
912
 
853
913
  --
854
914
  -- Name: index_versions_on_user_id_and_user_type; Type: INDEX; Schema: public; Owner: -
855
915
  --
856
916
 
857
- CREATE INDEX index_versions_on_user_id_and_user_type ON versions USING btree (user_id, user_type);
917
+ CREATE INDEX index_versions_on_user_id_and_user_type ON public.versions USING btree (user_id, user_type);
858
918
 
859
919
 
860
920
  --
861
921
  -- Name: index_versions_on_user_name; Type: INDEX; Schema: public; Owner: -
862
922
  --
863
923
 
864
- CREATE INDEX index_versions_on_user_name ON versions USING btree (user_name);
924
+ CREATE INDEX index_versions_on_user_name ON public.versions USING btree (user_name);
865
925
 
866
926
 
867
927
  --
868
928
  -- Name: index_versions_on_versioned_id_and_versioned_type; Type: INDEX; Schema: public; Owner: -
869
929
  --
870
930
 
871
- CREATE INDEX index_versions_on_versioned_id_and_versioned_type ON versions USING btree (versioned_id, versioned_type);
931
+ CREATE INDEX index_versions_on_versioned_id_and_versioned_type ON public.versions USING btree (versioned_id, versioned_type);
872
932
 
873
933
 
874
934
  --
875
935
  -- Name: follows fk_rails_32479bd030; Type: FK CONSTRAINT; Schema: public; Owner: -
876
936
  --
877
937
 
878
- ALTER TABLE ONLY follows
879
- ADD CONSTRAINT fk_rails_32479bd030 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
938
+ ALTER TABLE ONLY public.follows
939
+ ADD CONSTRAINT fk_rails_32479bd030 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
880
940
 
881
941
 
882
942
  --
883
943
  -- Name: authorizations fk_rails_4ecef5b8c5; Type: FK CONSTRAINT; Schema: public; Owner: -
884
944
  --
885
945
 
886
- ALTER TABLE ONLY authorizations
887
- ADD CONSTRAINT fk_rails_4ecef5b8c5 FOREIGN KEY (user_id) REFERENCES users(id);
946
+ ALTER TABLE ONLY public.authorizations
947
+ ADD CONSTRAINT fk_rails_4ecef5b8c5 FOREIGN KEY (user_id) REFERENCES public.users(id);
888
948
 
889
949
 
890
950
  --
891
951
  -- Name: follows fk_rails_572bf69092; Type: FK CONSTRAINT; Schema: public; Owner: -
892
952
  --
893
953
 
894
- ALTER TABLE ONLY follows
895
- ADD CONSTRAINT fk_rails_572bf69092 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
954
+ ALTER TABLE ONLY public.follows
955
+ ADD CONSTRAINT fk_rails_572bf69092 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
956
+
957
+
958
+ --
959
+ -- Name: api_tokens fk_rails_f16b5e0447; Type: FK CONSTRAINT; Schema: public; Owner: -
960
+ --
961
+
962
+ ALTER TABLE ONLY public.api_tokens
963
+ ADD CONSTRAINT fk_rails_f16b5e0447 FOREIGN KEY (user_id) REFERENCES public.users(id);
896
964
 
897
965
 
898
966
  --
@@ -1006,6 +1074,7 @@ INSERT INTO "schema_migrations" (version) VALUES
1006
1074
  ('20170307032041'),
1007
1075
  ('20170307035755'),
1008
1076
  ('20170310024505'),
1009
- ('20170329030329');
1077
+ ('20170329030329'),
1078
+ ('20181102202848');
1010
1079
 
1011
1080
 
@@ -27,6 +27,10 @@ module Houston
27
27
  Trigger.new(self, method_name, value, action, params, persistent_trigger_id)
28
28
  end
29
29
 
30
+ def create(*args)
31
+ push build(*args)
32
+ end
33
+
30
34
  def push(trigger)
31
35
  raise DuplicateTriggerError, "That exact trigger has already been defined" if member?(trigger)
32
36
  super trigger
@@ -1,3 +1,3 @@
1
1
  module Houston
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: houston-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-16 00:00:00.000000000 Z
11
+ date: 2019-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -569,6 +569,7 @@ files:
569
569
  - app/controllers/actions_controller.rb
570
570
  - app/controllers/api/v1/measurements_controller.rb
571
571
  - app/controllers/api/v1/projects_controller.rb
572
+ - app/controllers/api_tokens_controller.rb
572
573
  - app/controllers/application_controller.rb
573
574
  - app/controllers/authorizations_controller.rb
574
575
  - app/controllers/concerns/.keep
@@ -604,6 +605,7 @@ files:
604
605
  - app/models/.keep
605
606
  - app/models/ability.rb
606
607
  - app/models/action.rb
608
+ - app/models/api_token.rb
607
609
  - app/models/authorization.rb
608
610
  - app/models/concerns/.keep
609
611
  - app/models/error.rb
@@ -622,6 +624,10 @@ files:
622
624
  - app/views/actions/running.html.erb
623
625
  - app/views/actions/show.html.erb
624
626
  - app/views/actions/unqueued.html.erb
627
+ - app/views/api_tokens/_form.html.erb
628
+ - app/views/api_tokens/edit.html.erb
629
+ - app/views/api_tokens/index.html.erb
630
+ - app/views/api_tokens/new.html.erb
625
631
  - app/views/authorizations/_form.html.erb
626
632
  - app/views/authorizations/edit.html.erb
627
633
  - app/views/authorizations/granted.html.erb
@@ -812,6 +818,7 @@ files:
812
818
  - db/migrate/20170307035755_allow_actions_started_at_to_be_null.rb
813
819
  - db/migrate/20170310024505_replace_authorizations_provider_name_with_type.rb
814
820
  - db/migrate/20170329030329_drop_consumer_tokens.rb
821
+ - db/migrate/20181102202848_create_api_tokens.rb
815
822
  - db/seeds.rb
816
823
  - db/structure.sql
817
824
  - houston-core.gemspec