mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
feat: add description column to Tags (#24553)
This commit is contained in:
parent
2b1275d8c4
commit
19deb9141d
@ -0,0 +1,39 @@
|
|||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you 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.
|
||||||
|
"""update_tag_model_w_description
|
||||||
|
|
||||||
|
Revision ID: 240d23c7f86f
|
||||||
|
Revises: 6fbe660cac39
|
||||||
|
Create Date: 2023-06-29 18:38:30.033529
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "240d23c7f86f"
|
||||||
|
down_revision = "6fbe660cac39"
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from alembic import op
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.add_column("tag", sa.Column("description", sa.Text(), nullable=True))
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_column("tag", "description")
|
@ -20,7 +20,7 @@ import enum
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from flask_appbuilder import Model
|
from flask_appbuilder import Model
|
||||||
from sqlalchemy import Column, Enum, ForeignKey, Integer, String
|
from sqlalchemy import Column, Enum, ForeignKey, Integer, String, Text
|
||||||
from sqlalchemy.engine.base import Connection
|
from sqlalchemy.engine.base import Connection
|
||||||
from sqlalchemy.orm import relationship, Session, sessionmaker
|
from sqlalchemy.orm import relationship, Session, sessionmaker
|
||||||
from sqlalchemy.orm.mapper import Mapper
|
from sqlalchemy.orm.mapper import Mapper
|
||||||
@ -76,6 +76,7 @@ class Tag(Model, AuditMixinNullable):
|
|||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
name = Column(String(250), unique=True)
|
name = Column(String(250), unique=True)
|
||||||
type = Column(Enum(TagTypes))
|
type = Column(Enum(TagTypes))
|
||||||
|
description = Column(Text)
|
||||||
|
|
||||||
objects = relationship(
|
objects = relationship(
|
||||||
"TaggedObject", back_populates="tag", overlaps="objects,tags"
|
"TaggedObject", back_populates="tag", overlaps="objects,tags"
|
||||||
|
Loading…
Reference in New Issue
Block a user