---  ~ 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.

create table gadget_comment
(
    gadget_comment_id    number(38) not null,
    gadget_id           number(38) not null,
    user_id             varchar2(50) not null,
    comment_text        varchar2(4000) not null,
    created_date  date not null,
    created_by_admin varchar2(1) not null,          
    gadget_version   varchar2(10) not null,
    gadget_rating  number(10),
    last_modified_user_id varchar2(50) not null,
    last_modified_date  date not null,    
    last_modified_by_admin varchar2(1) not null,            
    constraint gadget_comment_pk 
        primary key (gadget_comment_id),
    constraint gc_create_by_admin_chk
        check (created_by_admin in ('Y','N')),
    constraint gc_mod_by_admin_chk
        check (last_modified_by_admin in ('Y','N'))
);

alter table gadget_comment
add constraint gadget_comment_gadget_id_fk
foreign key (gadget_id)
references gadget (gadget_id);