Skip to content

Commit

Permalink
Rename user table to users to avoid conflict with postgres
Browse files Browse the repository at this point in the history
* Resolves issue 1083
  • Loading branch information
bolkedebruin committed Apr 2, 2016
1 parent 3813d51 commit ac4a7da
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
14 changes: 14 additions & 0 deletions airflow/hooks/http_hook.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from builtins import str
import logging

Expand Down
25 changes: 25 additions & 0 deletions airflow/migrations/versions/2e82aab8ef20_rename_user_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""rename user table
Revision ID: 2e82aab8ef20
Revises: 1968acfc09e3
Create Date: 2016-04-02 19:28:15.211915
"""

# revision identifiers, used by Alembic.
revision = '2e82aab8ef20'
down_revision = '1968acfc09e3'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
op.rename_table('user', 'users')


def downgrade():
op.rename_table('users', 'user')

6 changes: 3 additions & 3 deletions airflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def paused_dags(self):


class User(Base):
__tablename__ = "user"
__tablename__ = "users"

id = Column(Integer, primary_key=True)
username = Column(String(ID_LEN), unique=True)
Expand Down Expand Up @@ -2645,7 +2645,7 @@ class Chart(Base):
id = Column(Integer, primary_key=True)
label = Column(String(200))
conn_id = Column(String(ID_LEN), nullable=False)
user_id = Column(Integer(), ForeignKey('user.id'), nullable=True)
user_id = Column(Integer(), ForeignKey('users.id'), nullable=True)
chart_type = Column(String(100), default="line")
sql_layout = Column(String(50), default="series")
sql = Column(Text, default="SELECT series, x, y FROM table")
Expand Down Expand Up @@ -2681,7 +2681,7 @@ class KnownEvent(Base):
label = Column(String(200))
start_date = Column(DateTime)
end_date = Column(DateTime)
user_id = Column(Integer(), ForeignKey('user.id'),)
user_id = Column(Integer(), ForeignKey('users.id'),)
known_event_type_id = Column(Integer(), ForeignKey('known_event_type.id'),)
reported_by = relationship(
"User", cascade=False, cascade_backrefs=False, backref='known_events')
Expand Down
14 changes: 14 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import sys

import os
Expand Down

0 comments on commit ac4a7da

Please sign in to comment.