需要为近1000个软件包更新ssis连接管理器(Need to update ssis connection manager for almost 1000 packages)
我的团队正在将他们的SQL Server 2012更新为SQL Server 2016,因此我们必须更新我们的Visual Studio(2012)SSIS / Data Tools包连接以使用SQL Server 2016。
目前计划是逐一做到这一点!
有更快的方法吗?
My team is updating their SQL Server 2012 to SQL Server 2016, and thus we must update our Visual Studio (2012) SSIS/Data Tools package connections to use SQL Server 2016.
Currently the plan is to do this one by one!
Is there a faster way?
原文:https://stackoverflow.com/questions/46452528
最满意答案
感谢多态关联,我们可以将所有关系放在一个表中,如下所示:
create_table :follows do |t| t.references :followable, :polymorphic => true t.references :followed_by, :polymorphic => true end
然后模型是:
class User < ActiveRecord::Base has_many :following_objects, :class_name => 'Follow', :as => :followed_by has_many :followed_objects, :class_name => 'Follow', :as => :followable end class Company < ActiveRecord::Base has_many :following_objects, :class_name => 'Follow', :as => :followed_by has_many :followed_objects, :class_name => 'Follow', :as => :followable end class Follow < ActiveRecord::Base belongs_to :followable, :polymorphic => true belongs_to :followed_by, :polymorphic => true end
抱歉丑陋的名字。
Thanks to polymorphic associations, we can put all relations into one table which like this:
create_table :follows do |t| t.references :followable, :polymorphic => true t.references :followed_by, :polymorphic => true end
Then the models are:
class User < ActiveRecord::Base has_many :following_objects, :class_name => 'Follow', :as => :followed_by has_many :followed_objects, :class_name => 'Follow', :as => :followable end class Company < ActiveRecord::Base has_many :following_objects, :class_name => 'Follow', :as => :followed_by has_many :followed_objects, :class_name => 'Follow', :as => :followable end class Follow < ActiveRecord::Base belongs_to :followable, :polymorphic => true belongs_to :followed_by, :polymorphic => true end
Sorry for the ugly names.
相关问答
更多-
该错误是因为您有循环导入。 两个模块不可能相互导入。 在这种情况下,您无需将模型导入每个应用程序。 删除导入,然后使用字符串app_label.ModelName 。 # app1.models.py class FirstModel(models.Model): first_field = models.ManyToManyField('app2.SecondModel') # app2.models.py class SecondModel(models.Model): second_ ...
-
观点和模型之间的关系(relation among views and models)[2022-06-22]
MVC(模型视图控制器)是一个设计模式 ,基于做一件事的原则,并做得很好...... 单个模型可以与N个视图一起使用......这就是MVC的特性。 模型包含业务逻辑和数据 View是用于向用户显示结果的内容。 控制器是完成操作的控制器 java中的Swing基于MVC。 也称为PLAF (Pluggable Look and Feel)。 一个Java程序,其中Model与View分开,可以轻松地与不同的View一起使用。 例如:业务逻辑编写得很好,与View部分分开,可以在Swing中使用,也可以用JS ... -
感谢多态关联,我们可以将所有关系放在一个表中,如下所示: create_table :follows do |t| t.references :followable, :polymorphic => true t.references :followed_by, :polymorphic => true end 然后模型是: class User < ActiveRecord::Base has_many :following_objects, :class_nam ...
-
是的,这正是我做的。 如果您需要向模型添加更多元素或使用属性装饰模型,则以后简单易用。 或者,您可以使用Tuple ,将模型类型声明为: @model Tuple
> Yeah, that's exactly how I'd do it. It's simple and easy to extend later if you need to add more elements to the model or decorate the model with a ... -
我建议使用store_accessor和STI的组合。 商店访问者将允许您添加模型特定属性并支持验证。 如果使用PostgreSQL,您可以利用GIN / GiST索引有效地搜索自定义字段。 class User < ActiveRecord::Base has_many :friends end class Friend < ActiveRecord::Base belongs_to :user # exclude nil values from uniq check v ...
-
在这种情况下有两个ForeignKey字段是可以的。 ManyToManyField可能会导致错误,当3队将被添加。 因此,您可以使用ForeignKey指定两个ForeignKey字段: class Match(models.Model): team1 = models.ForeignKey('Team', related_name='team1') team2 = models.ForeignKey('Team', related_name='team2') tournament ...
-
您的关系假定user_id为外键作为默认值。 您还可以通过将其他参数传递给hasMany方法来覆盖外键和本地键: return $this->hasMany('App\Ticket', 'foreign_key', 'local_key'); 所以, 用户模型: public function tickets() { return $this->hasMany('App\Ticket','userId','id'); } 门票型号: public function use ...
-
我通常通过重写我的视图的创建/更新来调用一些业务或额外的验证步骤来解决此问题,然后调用序列化器的保存。 I usually solve this by rewriting my view's create / update to call some business or extra validation steps before calling the serializer's save.
-
目前,关系仅存在于MySQL和SQLite3等关系数据库中。 因此,您需要进行两次查询才能获得所需的数据。 我们正在努力为基于文档的数据库添加对关系的支持,但目前还没有时间表。 您可以在帖子的结果上使用Set :: extract来提取所有用户ID,然后使用其中的结果从用户进行单个查询 - 所以从你可以做的帖子$ userIDs = Set :: extract('/ posts / user_id',$ posts-> data()); 然后User :: find('all',array('condit ...
-
Django模型不支持多个主键: https : //docs.djangoproject.com/en/1.3/faq/models/#do-django-models-support-multiple-column-primary-keys 但是,正如文档所描述的那样,您可以使用ForeignKey字段上的其他属性(如unique_together)来执行相同的操作。 希望能帮到你。 Django models don't support multiple primary keys: https://d ...