database-schema

How to set default schema in Yii2

你离开我真会死。 提交于 2019-12-19 05:23:54
问题 My Yii2 is setup with PostgreSQL. Instead of using separate database per project, I like to use schema for each project. Problem with later setup is that I can't figure out how to select default schema "defaultSchema" through configuration. I am having a problem with migrations table because it defaults to "public" schema when I run migration command. Default "public" schema also prevents using database user's search_path. Although I set up my db user with "search_path=myschema, public" I

Hibernate: Found: float, expected: double precision

你离开我真会死。 提交于 2019-12-18 21:49:44
问题 I have a problem with the mapping of Oracle Float double precision datatype to Java Double datatype. The hibernate schema validator seems to fail when the Java Double datatype is used. org.hibernate.HibernateException: Wrong column type in DB.TABLE for column amount. Found: float, expected: double precision The only way to avoid this is to disable schema validation and hope the schema is in sync with the app about to run. It must be fixed before it goes out to production. App's evironment: -

How to model a database with many m:n relations on a table

心已入冬 提交于 2019-12-18 15:35:24
问题 I am currently setting up a database which has a large number of many-to-many relations. Every relationship was modeled via a link table. Example: A person has a number of jobs, jobs are fulfilled by a number of persons. A person has a number of houses, houses are occupied by a number of persons. A person has a number of restaurants he likes, restaurants have a number of persons who like the restaurant. First I designed this as follows: Tables: Person, Job, House, Restaurant, Person_Job,

Schema for User Ratings - Key/Value DB

落花浮王杯 提交于 2019-12-18 13:15:12
问题 We're using MongoDB and I'm figuring out a schema for storing Ratings. Ratings will have values of 1-5. I want to store other values such as fromUser This is fine but the main question I have is setting it up so that recalculating the average is as efficient as possible. SOLUTION 1 - Separate Ratings Class The first thought was to create a separate Ratings class and store an array of pointers to Ratings in the User class. The reason I second guessed this is that we will have to query for all

Normalize table to 3rd normal form

為{幸葍}努か 提交于 2019-12-18 12:34:47
问题 This questions is obviously a homework question. I can't understand my professor and have no idea what he said during the election. I need to make step by step instructions to normalize the following table first into 1NF, then 2NF, then 3NF. I appreciate any help and instruction. 回答1: Okay, I hope I remember all of them correctly, let's start... Rules To make them very short (and not very precise, just to give you a first idea of what it's all about): NF1 : A table cell must not contain more

Group output of SHOW COLUMNS into comma-delimited list

折月煮酒 提交于 2019-12-18 11:46:05
问题 I am comparing database tables on a development server against a live server, looking for column name changes, new columns, and columns that have been dropped. I'd like to do something like this: SELECT GROUP_CONCAT(Field) FROM (SHOW COLUMNS ON table_name) GROUP BY Field What I am after is a comma-delimited list that I can then take to the live server and do: SHOW COLUMNS FROM table_name WHERE NOT IN ([comma-delimited list from above query]) Any thoughts on how best to do this - either by

How does Trello store data in MongoDB? (Collection per board?)

风流意气都作罢 提交于 2019-12-18 11:27:28
问题 How does Trello store their data (cards) in MongoDB? I read ( How does Trello show history so quickly? ) that their Actions collection is the largest one. Thus I assume that they do not store all cards in one gigantic collection. The only other logical solution seems a collection per board or per user. But they have a lot of users and I read ( http://www.mongodb.org/display/DOCS/Using+a+Large+Number+of+Collections ) that there is a limit on the number of collections and some people advise

How to determine the auto-generated primary key used as a foreign key for another table

北战南征 提交于 2019-12-18 09:53:05
问题 This is a two-part question. Attached is a diagram for a PostgreSQL database table design. There are four tables. Table Main has a one-to-many relationship with table Submain . Table Submain has a one-many relationship with table Subsub . The primary keys for all four tables are serial NOT NULL (so they auto-increment). Each table has multiple attributes that are not shown here. Question 1. Multiple users will access this application and database. When a user accesses an application that uses

Cannot create a new table after “DROP SCHEMA public”

*爱你&永不变心* 提交于 2019-12-17 22:27:03
问题 Since I wanted to drop some tables and somebody suggested the below and I did it: postgres=# drop schema public cascade; DROP SCHEMA postgres=# create schema public; CREATE SCHEMA Then I got problem when creating a new database, such as: postgres=# create database test; CREATE DATABASE postgres=# \c test You are now connected to database "test" as user "postgres". test=# create table hi(id int primary key); *ERROR: no schema has been selected to create in* You can see I got error ERROR: no

Designing a SQL schema for a combination of many-to-many relationship (variations of products)

☆樱花仙子☆ 提交于 2019-12-17 17:33:10
问题 I hope the title is somewhat helpful. I'm using MySQL as my database I am building a database of products and am not sure how to handle storing prices/SKU of variations of a product. A product may have unlimited variations, and each variation combination has its own price/SKU/etc.. This is how I have my products/variations table set up at the moment: PRODUCTS +--------------------------+ | id | name | description | +----+------+--------------+ | 1 | rug | a cool rug | | 2 | cup | a coffee cup