{"id":37451,"date":"2023-10-30T06:20:16","date_gmt":"2023-10-30T06:20:16","guid":{"rendered":"https:\/\/www.railscarma.com\/?p=37451"},"modified":"2023-10-30T06:20:21","modified_gmt":"2023-10-30T06:20:21","slug":"datenbankmodelle-und-migrationen-in-rails-mit-sql-server","status":"publish","type":"post","link":"https:\/\/www.railscarma.com\/de\/blog\/datenbankmodelle-und-migrationen-in-rails-mit-sql-server\/","title":{"rendered":"Datenbankmodelle und Migrationen in Rails mit SQL Server"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"37451\" class=\"elementor elementor-37451\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-1231ecb elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1231ecb\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ff5a101\" data-id=\"ff5a101\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a3745e9 elementor-widget elementor-widget-text-editor\" data-id=\"a3745e9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Ruby on Rails ist ein leistungsf\u00e4higes Framework f\u00fcr Webanwendungen, das eine bequeme M\u00f6glichkeit zur Interaktion mit Datenbanken bietet. Wenn Sie mit SQL Server als Datenbankmanagementsystem arbeiten, ist es wichtig zu wissen, wie Sie Datenbankmodelle definieren und Schema\u00e4nderungen mit Rails-Migrationen verwalten. In diesem Artikel gehen wir durch den Prozess der Erstellung von <b>Datenbankmodelle und Migrationen in Rails-Anwendungen<\/b> w\u00e4hrend wir SQL Server als unser Datenbank-Backend verwenden.<\/p>\n<h2><strong>Voraussetzungen<\/strong><\/h2>\n<ul>\n<li>Ruby on Rails ist auf Ihrem System installiert.<\/li>\n<li>Eine eingerichtete und zug\u00e4ngliche SQL Server-Instanz.<\/li>\n<\/ul>\n<h2><b>Erstellen einer neuen Rails-Anwendung<\/b><\/h2>\n<p>Beginnen wir mit der Erstellung einer neuen Rails-Anwendung. \u00d6ffnen Sie Ihr Terminal und f\u00fchren Sie den folgenden Befehl aus:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"pln\">Schienen neue sql_server_rails_app<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Dieser Befehl generiert eine neue Rails-Anwendung mit dem Namen&nbsp;<code>sql_server_rails_app<\/code>. Navigieren Sie zum Projektverzeichnis:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"pln\">cd sql_server_rails_app<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Um SQL Server als Datenbank zu konfigurieren, \u00f6ffnen Sie die&nbsp;<code>config\/database.yml<\/code>&nbsp;Datei und \u00e4ndern Sie sie wie folgt:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">Yaml<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"kwd\">Standard<\/span><span class=\"pun\">:<\/span> <span class=\"pun\">&amp;<\/span><span class=\"kwd\">Standard<\/span><span class=\"pln\">\n  Adapter<\/span><span class=\"pun\">:<\/span><span class=\"pln\"> SQLServer-Host<\/span><span class=\"pun\">:<\/span><span class=\"pln\"> localhost-Benutzername<\/span><span class=\"pun\">:<\/span><span class=\"pln\"> Ihr_Benutzername-Passwort<\/span><span class=\"pun\">:<\/span><span class=\"pln\"> Ihr Passwort\n  <\/span><span class=\"kwd\">Datenbank<\/span><span class=\"pun\">:<\/span><span class=\"pln\"> Ihr_Datenbankname-Port<\/span><span class=\"pun\">:<\/span> <span class=\"lit\">1433<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Ersetzen&nbsp;<code>dein Benutzername<\/code>,&nbsp;<code>Ihr Passwort<\/code>, Und&nbsp;<code>Ihr_Datenbankname<\/code>&nbsp;mit Ihren SQL Server-Anmeldeinformationen und dem gew\u00fcnschten Datenbanknamen.<\/p>\n<h2><b>Erstellen eines Datenbankmodells<\/b><\/h2>\n<p>Lassen Sie uns ein einfaches Datenbankmodell f\u00fcr eine Blog-Anwendung erstellen. F\u00fchren Sie den folgenden Befehl aus, um eine&nbsp;<code>Post<\/code>&nbsp;Modell mit Attributen:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"pln\">Schienen generieren Modell-Beitragstitel<\/span><span class=\"pun\">:<\/span><span class=\"pln\">Saitenk\u00f6rper<\/span><span class=\"pun\">:<\/span><span class=\"pln\">Text<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Dieser Befehl erstellt eine Migrationsdatei im&nbsp;<code>db\/migration<\/code>&nbsp;Verzeichnis und eine entsprechende Modelldatei im&nbsp;<code>App\/Modelle<\/code>&nbsp;Verzeichnis.<\/p>\n<h2><b>Erstellen einer Migration<\/b><\/h2>\n<p>\u00d6ffnen Sie die generierte Migrationsdatei im&nbsp;<code>db\/migration<\/code>&nbsp;Verzeichnis. Es wird einen Namen haben wie&nbsp;<code>xxxxxx_create_posts.rb<\/code>, Wo&nbsp;<code>xxxxxx<\/code>&nbsp;ist ein Zeitstempel. F\u00fcgen Sie die erforderlichen Spalten hinzu&nbsp;<code>Tabelle erstellen<\/code>&nbsp;Block:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">Rubin<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"pln\">Klasse CreatePosts <\/span><span class=\"pun\">&lt;<\/span><span class=\"pln\"> Aktiver Rekord<\/span><span class=\"pun\">::<\/span><span class=\"pln\">Migration<\/span><span class=\"pun\">[<\/span><span class=\"lit\">6.1<\/span><span class=\"pun\">]<\/span><span class=\"pln\">\n  auf jeden Fall create_table \u00e4ndern <\/span><span class=\"pun\">:<\/span><span class=\"pln\">Beitr\u00e4ge tun <\/span><span class=\"pun\">|<\/span><span class=\"pln\">T<\/span><span class=\"pun\">|<\/span><span class=\"pln\">\n      T<\/span><span class=\"pun\">.<\/span><span class=\"pln\">Zeichenfolge <\/span><span class=\"pun\">:<\/span><span class=\"pln\">Titel t<\/span><span class=\"pun\">.<\/span><span class=\"pln\">Text <\/span><span class=\"pun\">:<\/span><span class=\"pln\">K\u00f6rper t<\/span><span class=\"pun\">.<\/span><span class=\"pln\">Zeitstempel\n    <\/span><span class=\"kwd\">Ende<\/span>\n  <span class=\"kwd\">Ende<\/span>\n<span class=\"kwd\">Ende<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Durch diese Migration entsteht ein&nbsp;<code>Beitr\u00e4ge<\/code>&nbsp;Tisch mit&nbsp;<code>Titel<\/code>&nbsp;Und&nbsp;<code>K\u00f6rper<\/code>&nbsp;S\u00e4ulen.<\/p>\n<h2><b>Ausf\u00fchren von Migrationen<\/b><\/h2>\n<p>Um die Migration anzuwenden und zu erstellen&nbsp;<code>Beitr\u00e4ge<\/code>&nbsp;F\u00fchren Sie f\u00fcr die Tabelle in der SQL Server-Datenbank den folgenden Befehl aus:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">bash<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"pln\">Schienen db<\/span><span class=\"pun\">:<\/span><span class=\"pln\">Wandern<\/span><\/pre>\n<\/div>\n<\/div>\n<p>Dieser Befehl f\u00fchrt alle ausstehenden Migrationen aus und aktualisiert das Datenbankschema entsprechend.<\/p>\n<h2><b>Verwendung des Modells<\/b><\/h2>\n<p>Nun, da die&nbsp;<code>Post<\/code>&nbsp;Nachdem Modell und Tabelle erstellt wurden, k\u00f6nnen Sie sie in Ihrem verwenden&nbsp;<a href=\"https:\/\/www.railscarma.com\/de\/\">Rails-Anwendung<\/a>. Sie k\u00f6nnen beispielsweise einen neuen Beitrag in Ihrem Controller erstellen:<\/p>\n<div class=\"bg-black rounded-md mb-4\">\n<div class=\"flex items-center relative text-gray-200 bg-gray-800 gizmo:dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md\">Rubin<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<pre class=\"prettyprint lang-mssql prettyprinted\"><span class=\"pln\">Klasse PostsController <\/span><span class=\"pun\">&lt;<\/span><span class=\"pln\"> ApplicationController-Def <\/span><span class=\"kwd\">erstellen<\/span>\n    <span class=\"pun\">@<\/span><span class=\"pln\">Post <\/span><span class=\"pun\">=<\/span><span class=\"pln\"> Post<\/span><span class=\"pun\">.<\/span><span class=\"pln\">neu<\/span><span class=\"pun\">(<\/span><span class=\"pln\">post_params<\/span><span class=\"pun\">)<\/span>\n    <span class=\"kwd\">Wenn<\/span> <span class=\"pun\">@<\/span><span class=\"pln\">Post<\/span><span class=\"pun\">.<\/span><span class=\"kwd\">speichern<\/span><span class=\"pln\">\n      Redirect_to <\/span><span class=\"pun\">@<\/span><span class=\"pln\">Post<\/span><span class=\"pun\">,<\/span><span class=\"pln\"> beachten<\/span><span class=\"pun\">:<\/span> <span class=\"str\">\u201eBeitrag wurde erfolgreich erstellt.\u201c<\/span>\n    <span class=\"kwd\">anders<\/span><span class=\"pln\">\n      machen <\/span><span class=\"pun\">:<\/span><span class=\"pln\">neu\n    <\/span><span class=\"kwd\">Ende<\/span>\n  <span class=\"kwd\">Ende<\/span><span class=\"pln\">\n  private def post_params params<\/span><span class=\"pun\">.<\/span><span class=\"pln\">erfordern<\/span><span class=\"pun\">(:<\/span><span class=\"pln\">Post<\/span><span class=\"pun\">).<\/span><span class=\"pln\">erlauben<\/span><span class=\"pun\">(:<\/span><span class=\"pln\">Titel<\/span><span class=\"pun\">,<\/span> <span class=\"pun\">:<\/span><span class=\"pln\">K\u00f6rper<\/span><span class=\"pun\">)<\/span>\n  <span class=\"kwd\">Ende<\/span>\n<span class=\"kwd\">Ende<\/span><\/pre>\n<\/div>\n<\/div>\n<h2><b>Abschluss<\/b><\/h2>\n<p>In diesem Blogbeitrag haben wir gelernt, wie man Datenbankmodelle und Migrationen in einer <a href=\"https:\/\/www.railscarma.com\/de\/entwicklung-kundenspezifischer-schienenanwendungen\/\">Ruby on Rails-Anwendung<\/a> Verwendung von SQL Server als Datenbank-Backend. Sie k\u00f6nnen jetzt mit der Erstellung Ihrer Anwendung mit der Leistungsf\u00e4higkeit und Flexibilit\u00e4t von Rails beginnen und gleichzeitig die Funktionen von SQL Server f\u00fcr die Datenspeicherung und den Datenabruf nutzen.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t  <div class=\"related-post slider\">\r\n        <div class=\"headline\">zusammenh\u00e4ngende Posts<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Was ist Offliberty Ruby Gem und wie funktioniert es?\" href=\"https:\/\/www.railscarma.com\/de\/blog\/was-ist-offliberty-ruby-gem-und-wie-funktioniert-es\/?related_post_from=41304\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/What-is-Offliberty-Ruby-Gem-and-How-It-Works.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Offliberty Ruby Gem\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/What-is-Offliberty-Ruby-Gem-and-How-It-Works.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/What-is-Offliberty-Ruby-Gem-and-How-It-Works-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/What-is-Offliberty-Ruby-Gem-and-How-It-Works-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/What-is-Offliberty-Ruby-Gem-and-How-It-Works-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Was ist Offliberty Ruby Gem und wie funktioniert es?\" href=\"https:\/\/www.railscarma.com\/de\/blog\/was-ist-offliberty-ruby-gem-und-wie-funktioniert-es\/?related_post_from=41304\">\r\n        Was ist Offliberty Ruby Gem und wie funktioniert es?  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Rails link_to Methode: Die vollst\u00e4ndige Anleitung mit Beispielen\" href=\"https:\/\/www.railscarma.com\/de\/blog\/rails-link_to-method-the-complete-guide-with-examples\/?related_post_from=41296\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Rails-link_to-Method-The-Complete-Guide-with-Examples.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Rails link_to Methode\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Rails-link_to-Method-The-Complete-Guide-with-Examples.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Rails-link_to-Method-The-Complete-Guide-with-Examples-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Rails-link_to-Method-The-Complete-Guide-with-Examples-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Rails-link_to-Method-The-Complete-Guide-with-Examples-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Rails link_to Methode: Die vollst\u00e4ndige Anleitung mit Beispielen\" href=\"https:\/\/www.railscarma.com\/de\/blog\/rails-link_to-method-the-complete-guide-with-examples\/?related_post_from=41296\">\r\n        Rails link_to Methode: Die vollst\u00e4ndige Anleitung mit Beispielen  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Wie man eine skalierbare SaaS-Plattform mit Ruby on Rails aufbaut\" href=\"https:\/\/www.railscarma.com\/de\/blog\/how-to-build-a-scalable-saas-platform-using-ruby-on-rails\/?related_post_from=41273\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Build-a-SaaS-Platform-Using-Ruby-on-Rails.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Aufbau einer SaaS-Plattform mit Ruby on Rails\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Build-a-SaaS-Platform-Using-Ruby-on-Rails.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Build-a-SaaS-Platform-Using-Ruby-on-Rails-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Build-a-SaaS-Platform-Using-Ruby-on-Rails-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Build-a-SaaS-Platform-Using-Ruby-on-Rails-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Wie man eine skalierbare SaaS-Plattform mit Ruby on Rails aufbaut\" href=\"https:\/\/www.railscarma.com\/de\/blog\/how-to-build-a-scalable-saas-platform-using-ruby-on-rails\/?related_post_from=41273\">\r\n        Wie man eine skalierbare SaaS-Plattform mit Ruby on Rails aufbaut  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Ruby Regex Match Guide (2026) mit Beispielen\" href=\"https:\/\/www.railscarma.com\/de\/blog\/ruby-regex-match-guide-with-examples\/?related_post_from=41249\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Ruby-Regex-Match-Guide-with-Examples.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Ruby Regex Match\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Ruby-Regex-Match-Guide-with-Examples.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Ruby-Regex-Match-Guide-with-Examples-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Ruby-Regex-Match-Guide-with-Examples-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/04\/Ruby-Regex-Match-Guide-with-Examples-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Ruby Regex Match Guide (2026) mit Beispielen\" href=\"https:\/\/www.railscarma.com\/de\/blog\/ruby-regex-match-guide-with-examples\/?related_post_from=41249\">\r\n        Ruby Regex Match Guide (2026) mit Beispielen  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 10px;\r\n      padding: 10px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 14px !important;\r\n      color: #999999 !important;\r\n          }\r\n\r\n    .related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 14px;\r\n      color: #000000;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 12px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 2,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 2,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: false,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: false,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>","protected":false},"excerpt":{"rendered":"<p>Ruby on Rails is a powerful web application framework that provides a convenient way to interact with databases. When working with SQL Server as your database management system, it&#8217;s crucial to understand how to define database models and manage schema changes using Rails migrations. In this article, we&#8217;ll walk through the process of creating database &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.railscarma.com\/de\/blog\/ruby-regex-match-guide-with-examples\/\"> <span class=\"screen-reader-text\">Ruby Regex Match Guide (2026) mit Beispielen<\/span> Weiterlesen \u00bb<\/a><\/p>","protected":false},"author":5,"featured_media":37459,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1224],"tags":[],"class_list":["post-37451","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Database Models and Migrations in Rails with SQL Server - RailsCarma<\/title>\n<meta name=\"description\" content=\"Efficiently manage Rails database models and migrations with SQL Server. Simplify web app development using SQL Server in Rails. Learn more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.railscarma.com\/de\/blog\/datenbankmodelle-und-migrationen-in-rails-mit-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Database Models and Migrations in Rails with SQL Server - RailsCarma\" \/>\n<meta property=\"og:description\" content=\"Efficiently manage Rails database models and migrations with SQL Server. Simplify web app development using SQL Server in Rails. Learn more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.railscarma.com\/de\/blog\/datenbankmodelle-und-migrationen-in-rails-mit-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RailsCarma\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-30T06:20:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-30T06:20:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nikhil\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@railscarma\" \/>\n<meta name=\"twitter:site\" content=\"@railscarma\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nikhil\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/\"},\"author\":{\"name\":\"Nikhil\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/1aa0357392b349082303e8222c35c30c\"},\"headline\":\"Database Models and Migrations in Rails with SQL Server\",\"datePublished\":\"2023-10-30T06:20:16+00:00\",\"dateModified\":\"2023-10-30T06:20:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/\"},\"wordCount\":392,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.railscarma.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg\",\"articleSection\":[\"Blogs\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/\",\"url\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/\",\"name\":\"Database Models and Migrations in Rails with SQL Server - RailsCarma\",\"isPartOf\":{\"@id\":\"https:\/\/www.railscarma.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg\",\"datePublished\":\"2023-10-30T06:20:16+00:00\",\"dateModified\":\"2023-10-30T06:20:21+00:00\",\"description\":\"Efficiently manage Rails database models and migrations with SQL Server. Simplify web app development using SQL Server in Rails. Learn more.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage\",\"url\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg\",\"contentUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg\",\"width\":800,\"height\":300,\"caption\":\"Database Models and Migrations in Rails with SQL Server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.railscarma.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Database Models and Migrations in Rails with SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.railscarma.com\/#website\",\"url\":\"https:\/\/www.railscarma.com\/\",\"name\":\"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development\",\"description\":\"RailsCarma is a Ruby on Rails Development Company in Bangalore. We specialize in Offshore Ruby on Rails Development based out in USA and India. Hire experienced Ruby on Rails developers for the ultimate Web Experience.\",\"publisher\":{\"@id\":\"https:\/\/www.railscarma.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.railscarma.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.railscarma.com\/#organization\",\"name\":\"RailsCarma\",\"url\":\"https:\/\/www.railscarma.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png\",\"contentUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png\",\"width\":200,\"height\":46,\"caption\":\"RailsCarma\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RailsCarma\/\",\"https:\/\/x.com\/railscarma\",\"https:\/\/www.linkedin.com\/company\/railscarma\/\",\"https:\/\/myspace.com\/railscarma\",\"https:\/\/in.pinterest.com\/railscarma\/\",\"https:\/\/www.youtube.com\/channel\/UCx3Wil-aAnDARuatTEyMdpg\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/1aa0357392b349082303e8222c35c30c\",\"name\":\"Nikhil\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054f31ff35e9917aaf631b8025ef679d42dd21792012d451763138d66d02a4c0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054f31ff35e9917aaf631b8025ef679d42dd21792012d451763138d66d02a4c0?s=96&d=mm&r=g\",\"caption\":\"Nikhil\"},\"sameAs\":[\"https:\/\/www.railscarma.com\/hire-ruby-on-rails-developer\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Datenbankmodelle und Migrationen in Rails mit SQL Server \u2013 RailsCarma","description":"Verwalten Sie Rails-Datenbankmodelle und -Migrationen effizient mit SQL Server. Vereinfachen Sie die Entwicklung von Web-Apps mit SQL Server in Rails. Erfahren Sie mehr.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.railscarma.com\/de\/blog\/datenbankmodelle-und-migrationen-in-rails-mit-sql-server\/","og_locale":"de_DE","og_type":"article","og_title":"Database Models and Migrations in Rails with SQL Server - RailsCarma","og_description":"Efficiently manage Rails database models and migrations with SQL Server. Simplify web app development using SQL Server in Rails. Learn more.","og_url":"https:\/\/www.railscarma.com\/de\/blog\/datenbankmodelle-und-migrationen-in-rails-mit-sql-server\/","og_site_name":"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development","article_publisher":"https:\/\/www.facebook.com\/RailsCarma\/","article_published_time":"2023-10-30T06:20:16+00:00","article_modified_time":"2023-10-30T06:20:21+00:00","og_image":[{"width":800,"height":300,"url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg","type":"image\/jpeg"}],"author":"Nikhil","twitter_card":"summary_large_image","twitter_creator":"@railscarma","twitter_site":"@railscarma","twitter_misc":{"Verfasst von":"Nikhil","Gesch\u00e4tzte Lesezeit":"3\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#article","isPartOf":{"@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/"},"author":{"name":"Nikhil","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/1aa0357392b349082303e8222c35c30c"},"headline":"Database Models and Migrations in Rails with SQL Server","datePublished":"2023-10-30T06:20:16+00:00","dateModified":"2023-10-30T06:20:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/"},"wordCount":392,"commentCount":0,"publisher":{"@id":"https:\/\/www.railscarma.com\/#organization"},"image":{"@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg","articleSection":["Blogs"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/","url":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/","name":"Datenbankmodelle und Migrationen in Rails mit SQL Server \u2013 RailsCarma","isPartOf":{"@id":"https:\/\/www.railscarma.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg","datePublished":"2023-10-30T06:20:16+00:00","dateModified":"2023-10-30T06:20:21+00:00","description":"Verwalten Sie Rails-Datenbankmodelle und -Migrationen effizient mit SQL Server. Vereinfachen Sie die Entwicklung von Web-Apps mit SQL Server in Rails. Erfahren Sie mehr.","breadcrumb":{"@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#primaryimage","url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg","contentUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2023\/10\/Database-Models-and-Migrations-in-Rails-with-SQL-Server.jpg","width":800,"height":300,"caption":"Database Models and Migrations in Rails with SQL Server"},{"@type":"BreadcrumbList","@id":"https:\/\/www.railscarma.com\/es\/blog\/modelos-de-bases-de-datos-y-migraciones-en-rails-con-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.railscarma.com\/"},{"@type":"ListItem","position":2,"name":"Database Models and Migrations in Rails with SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/www.railscarma.com\/#website","url":"https:\/\/www.railscarma.com\/","name":"RailsCarma \u2013 Ruby on Rails-Entwicklungsunternehmen, spezialisiert auf Offshore-Entwicklung","description":"RailsCarma ist ein Ruby on Rails-Entwicklungsunternehmen in Bangalore. Wir sind auf die Offshore-Ruby-on-Rails-Entwicklung mit Sitz in den USA und Indien spezialisiert. Stellen Sie erfahrene Ruby on Rails-Entwickler f\u00fcr das ultimative Web-Erlebnis ein.","publisher":{"@id":"https:\/\/www.railscarma.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.railscarma.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/www.railscarma.com\/#organization","name":"SchienenCarma","url":"https:\/\/www.railscarma.com\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png","contentUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png","width":200,"height":46,"caption":"RailsCarma"},"image":{"@id":"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RailsCarma\/","https:\/\/x.com\/railscarma","https:\/\/www.linkedin.com\/company\/railscarma\/","https:\/\/myspace.com\/railscarma","https:\/\/in.pinterest.com\/railscarma\/","https:\/\/www.youtube.com\/channel\/UCx3Wil-aAnDARuatTEyMdpg"]},{"@type":"Person","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/1aa0357392b349082303e8222c35c30c","name":"Nikhil","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054f31ff35e9917aaf631b8025ef679d42dd21792012d451763138d66d02a4c0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054f31ff35e9917aaf631b8025ef679d42dd21792012d451763138d66d02a4c0?s=96&d=mm&r=g","caption":"Nikhil"},"sameAs":["https:\/\/www.railscarma.com\/hire-ruby-on-rails-developer\/"]}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/posts\/37451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/comments?post=37451"}],"version-history":[{"count":0,"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/posts\/37451\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/media\/37459"}],"wp:attachment":[{"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/media?parent=37451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/categories?post=37451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.railscarma.com\/de\/wp-json\/wp\/v2\/tags?post=37451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}