Skip to content
#

orm

Here are 2,416 public repositories matching this topic...

ozkanonur
ozkanonur commented Apr 13, 2020

Issue type:

[x] question
[ ] bug report
[ ] feature request
[x] documentation issue

Database system/driver:

[ ] cordova
[x] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

medyagh
medyagh commented Jan 4, 2020

followed the docs for has manyhttp://gorm.io/docs/has_many.html for sqlilite

package main

import (
	"fmt"

	"github.com/jinzhu/gorm"
	_ "github.com/mattn/go-sqlite3"
)


type User struct {
	Id          string
	Name        string
	CreditCards []CreditCard `gorm:"FOREIGNKEY:user_id;ASSOCIATION_FOREIGNKEY:id"`
}

type CreditCard struct {
	Id     int
	Number string
	UserID 
shvmgpt116
shvmgpt116 commented May 5, 2020

I am running a sample test in SqlServer where it is using ToString() on a string column (COL2) in the LINQ.
The test is giving following error when trying to generate SELECT query from the LINQ.

**Unhandled exception. System.InvalidOperationException: The LINQ expression 'DbSet
.Where(t => t.COL2.ToString().Contains(__url_0))' could

frames75
frames75 commented Feb 19, 2020

In the tutorial events there is this example:

const User = bookshelf.model('User', {
  tableName: 'users',

  initialize() {
    this.on('saving', (model) => {
      return User.forge({email: model.get('email')}).fetch().then((user) => {
        if (user) 
            throw new Error('That email address already exists')
    
sgrif
sgrif commented Feb 18, 2020

Given that we support CURRENT_TIMESTAMP, the lack of CURRENT_DATE feels like an omission. While you can hack it with date(now), I keep finding myself wishing there was a direct way to reference this. Given that now means CURRENT_TIMESTAMP, I think there's precedent for today meaning CURRENT_DATE. This is supported by all backends we support (and is in the ISO standard I believe).

MihailButnaru
MihailButnaru commented Jul 25, 2019

I was facing a problem and by reading the documentation, I was not be able to find the solution to the problem. The raw query section does not provide enough information, of how to use raw query method in different problems. Will be nice to add a section in the raw query that explains you, how to query a specific record through a nested array in mongo db.

` Example: Document.objects(raw={"_

maritaria
maritaria commented Sep 26, 2017
	let User = db.define("user", {
		name: { type: "text", required: true, unique: true },
		task_name: String,
		task_data: Object,
		last_seen: { type: 'date', time: true },
		card_url: { type: 'text' },
	});
	
	let Group = db.define("group", {
		name: { type: "text", required: true },
		general_chat: { type: "text", required: true, unique: true },
		admin_chat: { type: "t
KaneLeung
KaneLeung commented Oct 25, 2019

TIM截图20191025180951

DB.Updateable<t_stock_document>().SetColumns(k => new t_stock_document() { OutQTY = k.OutQTY - delDoc.F_Qty ?? 0, OutFinish = false }).Where(k => k.F_ID == delDoc.RelateID).ToSql();

语句中,使用??生成的Sql语句如图,运行时会报错 ,我以为是运算符优先级问题,
再加了括号试试,同样会报错,是否不支持??运算符
![TIM截图

videni
videni commented Sep 29, 2019

what is prefer way to add relation and remove relation? I found example as below, but I did't find any document about the two methods.

 case 'ADD_AUTHOR_TO_BOOK':
        Book.withId(action.payload.bookId).authors.add(action.payload.author);  // add new entity ,  add relation?  this doesn't work.
        break;
    case 'REMOVE_AUTHOR_FROM_BOOK':
        Book.withId(action.payload.bo
Ulfasaar
Ulfasaar commented Feb 20, 2020

Currently for table it says that the table has to be a string.

table

    (str) Used for many-to-many relationship only in order to specify the name of the intermediate table.

However it doesn't mention that it appears to follow the same form as the table attribute in entity classes, in the sense that you can pass it a tuple to specify the schema for databases like Postgresql.

haveamission
haveamission commented Dec 12, 2019

I am trying to generate a TypeScript model, and I am getting the above error.

My model looks like this:

/* jshint indent: 2 */
// tslint:disable
import * as sequelize from 'sequelize';
import {DataTypes} from 'sequelize';
import {email_tblInstance, email_tblAttribute} from './db';
module.exports = function(sequelize: sequelize.Sequelize, DataTypes: DataTypes) {
  return sequelize.

Improve this page

Add a description, image, and links to the orm topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the orm topic, visit your repo's landing page and select "manage topics."

Learn more

You can’t perform that action at this time.